Struct domain::bits::charstr::CharStrBuf
[−]
[src]
pub struct CharStrBuf { /* fields omitted */ }
An owned, mutable DNS character string.
This type adds the methods push()
, extend_from_slice()
, and
extend_from_str()
to the methods from CharStr
and [u8]
to
which it derefs (transitively). Note that the Extend
trait is not
implemented since adding data to a character string may fail if the
string would become too long.
In addition through the usual suspects, values can be created from
strings via the FromStr
trait as well as by parsing from master
file data through the scan()
function.
Methods
impl CharStrBuf
[src]
fn from_vec(vec: Vec<u8>) -> Option<Self>
Creates a new character string using the given vec.
Returns Some(_)
if the vector was at most 255 long or None
otherwise.
fn new() -> Self
Creates a new empty character string.
fn scan<S: Scanner>(scanner: &mut S) -> ScanResult<Self>
Scans a new character string from master data.
fn into_vec(self) -> Vec<u8>
Trades the character string for its raw bytes vector.
impl CharStrBuf
[src]
fn push(&mut self, ch: u8) -> Result<(), PushError>
Appends an octet to the end of the character string.
The method will fail if there isn’t room for additional data.
fn extend_from_slice<B: AsRef<[u8]>>(
&mut self,
bytes: B
) -> Result<(), PushError>
&mut self,
bytes: B
) -> Result<(), PushError>
Extends the character string with the contents of a bytes slice.
The method will fail if there isn’t room for adding the complete contents of the slice.
fn extend_from_str(&mut self, s: &str) -> Result<(), FromStrError>
Extends the character string with the contents of a Rust string.
The string must contain the master data representation of a
character string either as a regular word without white-space or
a single quoted entity. If the string cannot be converted, the
function fails with the appropriate error. If adding the resulting
data would exceed the length limit of the character string, the
method fails with FromStrError::LongString
.
Methods from Deref<Target = CharStr>
fn as_bytes(&self) -> &[u8]
Returns a reference to the character string’s data.
fn to_owned(&self) -> CharStrBuf
Returns an owned version of the character string.
fn len(&self) -> usize
Returns the length of the character string’s data in bytes.
fn is_empty(&self) -> bool
Returns whether the character string’s data is empty.
fn compose<C: AsMut<Composer>>(&self, target: C) -> ComposeResult<()>
Composes a character string.
Trait Implementations
impl Clone for CharStrBuf
[src]
fn clone(&self) -> CharStrBuf
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 Default for CharStrBuf
[src]
fn default() -> CharStrBuf
Returns the "default value" for a type. Read more
impl<'a> From<&'a CharStr> for CharStrBuf
[src]
impl FromStr for CharStrBuf
[src]
type Err = FromStrError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string s
to return a value of this type. Read more
impl Deref for CharStrBuf
[src]
type Target = CharStr
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
impl DerefMut for CharStrBuf
[src]
impl Borrow<CharStr> for CharStrBuf
[src]
impl Borrow<[u8]> for CharStrBuf
[src]
impl AsRef<CharStr> for CharStrBuf
[src]
impl AsRef<[u8]> for CharStrBuf
[src]
impl<C: AsRef<CharStr>> PartialEq<C> for CharStrBuf
[src]
fn eq(&self, other: &C) -> bool
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
This method tests for !=
.
impl Eq for CharStrBuf
[src]
impl<C: AsRef<CharStr>> PartialOrd<C> for CharStrBuf
[src]
fn partial_cmp(&self, other: &C) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for CharStrBuf
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Hash for CharStrBuf
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more