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
This commit is contained in:
Bobby Holley 2018-04-04 11:24:56 -07:00
parent a0bdba73e3
commit 628aa6a630

View file

@ -559,6 +559,12 @@ macro_rules! define_string_types {
hdr: $StringRepr::new(ClassFlags::NULL_TERMINATED), 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 { impl Drop for $String {