Struct nsstring::nsString
[−]
[src]
#[repr(C)]pub struct nsString { /* fields omitted */ }
Methods
impl nsString
[src]
Methods from Deref<Target = nsAString>
pub fn assign<T: nsStringLike + ?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: nsStringLike + ?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 nsAString)
[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 nsAString) -> 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: nsStringLike + ?Sized>(&mut self, other: &T)
[src]
Append the value of other
into self.
pub fn fallible_append<T: nsStringLike + ?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 [u16]
[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 [u16], ()>
[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_utf8<T: nsCStringLike + ?Sized>(&mut self, other: &T)
[src]
pub fn fallible_assign_utf8<T: nsCStringLike + ?Sized>(
&mut self,
other: &T
) -> Result<(), ()>
[src]
&mut self,
other: &T
) -> Result<(), ()>
pub fn append_utf8<T: nsCStringLike + ?Sized>(&mut self, other: &T)
[src]
pub fn fallible_append_utf8<T: nsCStringLike + ?Sized>(
&mut self,
other: &T
) -> Result<(), ()>
[src]
&mut self,
other: &T
) -> Result<(), ()>
Trait Implementations
impl PartialEq<nsString> for nsAString
[src]
fn eq(&self, other: &nsString) -> 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 nsString
[src]
impl Deref for nsString
[src]
type Target = nsAString
The resulting type after dereferencing.
fn deref(&self) -> &nsAString
[src]
Dereferences the value.
impl DerefMut for nsString
[src]
impl AsRef<[u16]> for nsString
[src]
impl<'a> From<&'a [u16]> for nsString
[src]
impl<'a> From<&'a Vec<u16>> for nsString
[src]
impl<'a> From<&'a nsAString> for nsString
[src]
impl From<Box<[u16]>> for nsString
[src]
impl From<Vec<u16>> for nsString
[src]
impl Write for nsString
[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 nsString
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl Debug for nsString
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl PartialEq for nsString
[src]
fn eq(&self, other: &nsString) -> 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<[u16]> for nsString
[src]
fn eq(&self, other: &[u16]) -> 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 [u16]> for nsString
[src]
fn eq(&self, other: &&'a [u16]) -> 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 nsString
[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 nsString
[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 !=
.