Struct Label
pub struct Label(/* private fields */);Available on crate feature
net only.Expand description
A single DNS label in presentation format.
Label is a borrowed, unsized view: you’ll always work with &Label,
produced either by Label::from_str (validated) or by internal helpers
that already maintain the invariant.
§Invariants
A &Label’s contents always satisfy:
- non-empty, at most
Label::MAX_LEN(63) bytes - either the single-byte wildcard form
"*", or a sequence of ASCII alphanumerics,_, and-, with no leading or trailing-
§Equality / ordering
Label’s PartialEq, Eq, Hash, Ord, and PartialOrd impls are
ASCII-case-insensitive. "Foo", "foo", and "FOO" compare equal and
hash to the same value.
Implementations§
§impl Label
impl Label
pub fn from_str(s: &str) -> Result<&Label, LabelError>
pub fn from_str(s: &str) -> Result<&Label, LabelError>
pub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the label length in bytes.
A label is non-empty by invariant, so length is always >= 1;
there is intentionally no is_empty method.
pub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Returns true if this is the wildcard label "*".
Trait Implementations§
§impl PartialOrd for Label
impl PartialOrd for Label
impl Eq for Label
Auto Trait Implementations§
impl Freeze for Label
impl RefUnwindSafe for Label
impl Send for Label
impl !Sized for Label
impl Sync for Label
impl Unpin for Label
impl UnsafeUnpin for Label
impl UnwindSafe for Label
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
Write
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
Write
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
Write
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
Write
value to writer