Struct rmpv::Utf8StringRef
[−]
[src]
pub struct Utf8StringRef<'a> { /* fields omitted */ }
A non-owning evil twin of Utf8String
. Does exactly the same thing except ownership.
Methods
impl<'a> Utf8StringRef<'a>
[src]
fn is_str(&self) -> bool
Returns true
if the string is valid UTF-8.
fn is_err(&self) -> bool
Returns true
if the string contains invalid UTF-8 sequence.
fn as_str(&self) -> Option<&str>
Returns the string reference if the string is valid UTF-8, or else None
.
fn as_err(&self) -> Option<&Utf8Error>
Returns the underlying Utf8Error
if the string contains invalud UTF-8 sequence, or
else None
.
fn as_bytes(&self) -> &[u8]
Returns a byte slice of this string contents no matter whether it's valid or not UTF-8.
fn into_str(self) -> Option<String>
Consumes this object, yielding the string if the string is valid UTF-8, or else None
.
fn into_bytes(self) -> Vec<u8>
Converts a Utf8StringRef
into a byte vector.
Trait Implementations
impl<'a> Clone for Utf8StringRef<'a>
[src]
fn clone(&self) -> Utf8StringRef<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> Copy for Utf8StringRef<'a>
[src]
impl<'a> Debug for Utf8StringRef<'a>
[src]
impl<'a> PartialEq for Utf8StringRef<'a>
[src]
fn eq(&self, __arg_0: &Utf8StringRef<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Utf8StringRef<'a>) -> bool
This method tests for !=
.
impl<'a> Display for Utf8StringRef<'a>
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<'a> From<&'a str> for Utf8StringRef<'a>
[src]
impl<'a> Into<Utf8String> for Utf8StringRef<'a>
[src]
fn into(self) -> Utf8String
Performs the conversion.