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]
impl CharStrBuf
pub fn from_vec(vec: Vec<u8>) -> Option<Self>
[src]
pub 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.
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new empty character string.
pub fn scan<S: Scanner>(scanner: &mut S) -> ScanResult<Self>
[src]
pub fn scan<S: Scanner>(scanner: &mut S) -> ScanResult<Self>
Scans a new character string from master data.
pub fn into_vec(self) -> Vec<u8>
[src]
pub fn into_vec(self) -> Vec<u8>
Trades the character string for its raw bytes vector.
impl CharStrBuf
[src]
impl CharStrBuf
pub fn push(&mut self, ch: u8) -> Result<(), PushError>
[src]
pub 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.
pub fn extend_from_slice<B: AsRef<[u8]>>(
&mut self,
bytes: B
) -> Result<(), PushError>
[src]
pub fn extend_from_slice<B: AsRef<[u8]>>(
&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.
pub fn extend_from_str(&mut self, s: &str) -> Result<(), FromStrError>
[src]
pub 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>
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Returns a reference to the character string’s data.
pub fn to_owned(&self) -> CharStrBuf
[src]
pub fn to_owned(&self) -> CharStrBuf
Returns an owned version of the character string.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the length of the character string’s data in bytes.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns whether the character string’s data is empty.
pub fn compose<C: AsMut<Composer>>(&self, target: C) -> ComposeResult<()>
[src]
pub fn compose<C: AsMut<Composer>>(&self, target: C) -> ComposeResult<()>
Composes a character string.
Trait Implementations
impl Clone for CharStrBuf
[src]
impl Clone for CharStrBuf
fn clone(&self) -> CharStrBuf
[src]
fn clone(&self) -> CharStrBuf
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for CharStrBuf
[src]
impl Default for CharStrBuf
fn default() -> CharStrBuf
[src]
fn default() -> CharStrBuf
Returns the "default value" for a type. Read more
impl<'a> From<&'a CharStr> for CharStrBuf
[src]
impl<'a> From<&'a CharStr> for CharStrBuf
impl FromStr for CharStrBuf
[src]
impl FromStr for CharStrBuf
type Err = FromStrError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
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]
impl Deref for CharStrBuf
type Target = CharStr
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl DerefMut for CharStrBuf
[src]
impl DerefMut for CharStrBuf
impl Borrow<CharStr> for CharStrBuf
[src]
impl Borrow<CharStr> for CharStrBuf
impl Borrow<[u8]> for CharStrBuf
[src]
impl Borrow<[u8]> for CharStrBuf
impl AsRef<CharStr> for CharStrBuf
[src]
impl AsRef<CharStr> for CharStrBuf
impl AsRef<[u8]> for CharStrBuf
[src]
impl AsRef<[u8]> for CharStrBuf
impl<C: AsRef<CharStr>> PartialEq<C> for CharStrBuf
[src]
impl<C: AsRef<CharStr>> PartialEq<C> for CharStrBuf
fn eq(&self, other: &C) -> bool
[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[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for CharStrBuf
[src]
impl Eq for CharStrBuf
impl<C: AsRef<CharStr>> PartialOrd<C> for CharStrBuf
[src]
impl<C: AsRef<CharStr>> PartialOrd<C> for CharStrBuf
fn partial_cmp(&self, other: &C) -> Option<Ordering>
[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[src]
fn lt(&self, other: &Rhs) -> bool
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[src]
fn le(&self, other: &Rhs) -> bool
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[src]
fn gt(&self, other: &Rhs) -> bool
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[src]
fn ge(&self, other: &Rhs) -> bool
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]
impl Ord for CharStrBuf
fn cmp(&self, other: &Self) -> Ordering
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for CharStrBuf
[src]
impl Hash for CharStrBuf
fn hash<H: Hasher>(&self, state: &mut H)
[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[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for CharStrBuf
[src]
impl Display for CharStrBuf
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for CharStrBuf
[src]
impl Debug for CharStrBuf
Auto Trait Implementations
impl Send for CharStrBuf
impl Send for CharStrBuf
impl Sync for CharStrBuf
impl Sync for CharStrBuf