Skip to content
Permalink
Browse files

Add an into_repr on the nsstring bindings.

I didn't end up using this, but mystor reviewed it and it's useful.

MozReview-Commit-ID: 5LNzCEGpbLy
  • Loading branch information
bholley committed Apr 6, 2018
1 parent a0bdba7 commit 628aa6a630b17d1c2ecde537cc452186f9d90725
Showing with 6 additions and 0 deletions.
  1. +6 −0 support/gecko/nsstring/src/lib.rs
@@ -559,6 +559,12 @@ macro_rules! define_string_types {
hdr: $StringRepr::new(ClassFlags::NULL_TERMINATED),
}
}

/// Converts this String into a StringRepr, which will leak if the
/// repr is not passed to something that knows how to free it.
pub fn into_repr(mut self) -> $StringRepr {
mem::replace(&mut self.hdr, $StringRepr::new(ClassFlags::NULL_TERMINATED))
}
}

impl Drop for $String {

0 comments on commit 628aa6a

Please sign in to comment.
You can’t perform that action at this time.