Struct nsstring::nsCString
[−]
[src]
#[repr(C)]pub struct nsCString { /* fields omitted */ }
Methods
impl nsCString
[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 PartialEq<nsCString> for nsACString
[src]
fn eq(&self, other: &nsCString) -> 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 Drop for nsCString
[src]
impl Deref for nsCString
[src]
type Target = nsACString
The resulting type after dereferencing.
fn deref(&self) -> &nsACString
[src]
Dereferences the value.
impl DerefMut for nsCString
[src]
fn deref_mut(&mut self) -> &mut nsACString
[src]
Mutably dereferences the value.
impl AsRef<[u8]> for nsCString
[src]
impl<'a> From<&'a [u8]> for nsCString
[src]
impl<'a> From<&'a Vec<u8>> for nsCString
[src]
impl<'a> From<&'a nsACString> for nsCString
[src]
fn from(s: &'a nsACString) -> nsCString
[src]
Performs the conversion.
impl From<Box<[u8]>> for nsCString
[src]
impl From<Vec<u8>> for nsCString
[src]
impl Write for nsCString
[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 Display for nsCString
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl Debug for nsCString
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl PartialEq for nsCString
[src]
fn eq(&self, other: &nsCString) -> 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 PartialEq<[u8]> for nsCString
[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> PartialEq<&'a [u8]> for nsCString
[src]
fn eq(&self, other: &&'a [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 PartialEq<str> for nsCString
[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> PartialEq<&'a str> for nsCString
[src]
fn eq(&self, other: &&'a 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 !=
.