Struct nsstring::nsCStr
[−]
[src]
#[repr(C)]pub struct nsCStr<'a> { /* fields omitted */ }
Methods
impl nsCStr<'static>
[src]
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<'a> PartialEq<nsCStr<'a>> for nsACString
[src]
fn eq(&self, other: &nsCStr<'a>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a> Drop for nsCStr<'a>
[src]
impl<'a> Deref for nsCStr<'a>
[src]
type Target = nsACString
The resulting type after dereferencing.
fn deref(&self) -> &nsACString
[src]
Dereferences the value.
impl<'a> DerefMut for nsCStr<'a>
[src]
fn deref_mut(&mut self) -> &mut nsACString
[src]
Mutably dereferences the value.
impl<'a> AsRef<[u8]> for nsCStr<'a>
[src]
impl<'a> From<&'a [u8]> for nsCStr<'a>
[src]
impl<'a> From<&'a Vec<u8>> for nsCStr<'a>
[src]
impl<'a> From<&'a nsACString> for nsCStr<'a>
[src]
fn from(s: &'a nsACString) -> nsCStr<'a>
[src]
Performs the conversion.
impl<'a> Write for nsCStr<'a>
[src]
fn write_str(&mut self, s: &str) -> Result<(), Error>
[src]
Writes a slice of bytes into this writer, returning whether the write succeeded. Read more
fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0[src]
Writes a [char
] into this writer, returning whether the write succeeded. Read more
fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
1.0.0[src]
Glue for usage of the [write!
] macro with implementors of this trait. Read more
impl<'a> Display for nsCStr<'a>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl<'a> Debug for nsCStr<'a>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl<'a> PartialEq for nsCStr<'a>
[src]
fn eq(&self, other: &nsCStr<'a>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a> PartialEq<[u8]> for nsCStr<'a>
[src]
fn eq(&self, other: &[u8]) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialEq<&'b [u8]> for nsCStr<'a>
[src]
fn eq(&self, other: &&'b [u8]) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a> PartialEq<str> for nsCStr<'a>
[src]
fn eq(&self, other: &str) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialEq<&'b str> for nsCStr<'a>
[src]
fn eq(&self, other: &&'b str) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.