Struct nsstring::nsCStringRepr
[−]
[src]
#[repr(C)]pub struct nsCStringRepr { /* fields omitted */ }
The representation of a ns[C]String type in C++. This type is used internally by our definition of ns[C]String to ensure layout compatibility with the C++ ns[C]String type.
This type may also be used in place of a C++ ns[C]String inside of struct definitions which are shared with C++, as it has identical layout to our ns[C]String type.
This struct will leak its data if dropped from rust. See the module documentation for more information on this type.
Methods from Deref<Target = nsACString>
pub fn assign<T: nsCStringLike + ?Sized>(&mut self, other: &T)
[src]
Assign the value of other
into self, overwriting any value
currently stored. Performs an optimized assignment when possible
if other
is a nsA[C]String
.
pub fn fallible_assign<T: nsCStringLike + ?Sized>(
&mut self,
other: &T
) -> Result<(), ()>
[src]
&mut self,
other: &T
) -> Result<(), ()>
Assign the value of other
into self, overwriting any value
currently stored. Performs an optimized assignment when possible
if other
is a nsA[C]String
.
Returns Ok(()) on success, and Err(()) if the allocation failed.
pub fn take_from(&mut self, other: &mut nsACString)
[src]
Take the value of other
and set self
, overwriting any value
currently stored. The passed-in string will be truncated.
pub fn fallible_take_from(&mut self, other: &mut nsACString) -> Result<(), ()>
[src]
Take the value of other
and set self
, overwriting any value
currently stored. If this function fails, the source string will
be left untouched, otherwise it will be truncated.
Returns Ok(()) on success, and Err(()) if the allocation failed.
pub fn append<T: nsCStringLike + ?Sized>(&mut self, other: &T)
[src]
Append the value of other
into self.
pub fn fallible_append<T: nsCStringLike + ?Sized>(
&mut self,
other: &T
) -> Result<(), ()>
[src]
&mut self,
other: &T
) -> Result<(), ()>
Append the value of other
into self.
Returns Ok(()) on success, and Err(()) if the allocation failed.
pub unsafe fn set_length(&mut self, len: u32)
[src]
Set the length of the string to the passed-in length, and expand the backing capacity to match. This method is unsafe as it can expose uninitialized memory when len is greater than the current length of the string.
pub unsafe fn fallible_set_length(&mut self, len: u32) -> Result<(), ()>
[src]
Set the length of the string to the passed-in length, and expand the backing capacity to match. This method is unsafe as it can expose uninitialized memory when len is greater than the current length of the string.
Returns Ok(()) on success, and Err(()) if the allocation failed.
pub fn truncate(&mut self)
[src]
pub fn to_mut(&mut self) -> &mut [u8]
[src]
Get a &mut
reference to the backing data for this string.
This method will allocate and copy if the current backing buffer
is immutable or shared.
pub fn fallible_to_mut(&mut self) -> Result<&mut [u8], ()>
[src]
Get a &mut
reference to the backing data for this string.
This method will allocate and copy if the current backing buffer
is immutable or shared.
Returns Ok(&mut [T])
on success, and Err(())
if the
allocation failed.
pub fn assign_utf16<T: nsStringLike + ?Sized>(&mut self, other: &T)
[src]
pub fn fallible_assign_utf16<T: nsStringLike + ?Sized>(
&mut self,
other: &T
) -> Result<(), ()>
[src]
&mut self,
other: &T
) -> Result<(), ()>
pub fn append_utf16<T: nsStringLike + ?Sized>(&mut self, other: &T)
[src]
pub fn fallible_append_utf16<T: nsStringLike + ?Sized>(
&mut self,
other: &T
) -> Result<(), ()>
[src]
&mut self,
other: &T
) -> Result<(), ()>
pub unsafe fn as_str_unchecked(&self) -> &str
[src]
Trait Implementations
impl Debug for nsCStringRepr
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Deref for nsCStringRepr
[src]
type Target = nsACString
The resulting type after dereferencing.
fn deref(&self) -> &nsACString
[src]
Dereferences the value.
impl DerefMut for nsCStringRepr
[src]
fn deref_mut(&mut self) -> &mut nsACString
[src]
Mutably dereferences the value.