pub struct Label(_);
Expand description
Labels are always stored as ASCII, unicode characters must be encoded with punycode
Implementations
sourceimpl Label
impl Label
sourcepub fn from_raw_bytes(bytes: &[u8]) -> ProtoResult<Self>
pub fn from_raw_bytes(bytes: &[u8]) -> ProtoResult<Self>
These must only be ASCII, with unicode encoded to PunyCode, or other such transformation.
This uses the bytes as raw ascii values, with nothing escaped on the wire.
Generally users should use from_str
or from_ascii
sourcepub fn from_utf8(s: &str) -> ProtoResult<Self>
pub fn from_utf8(s: &str) -> ProtoResult<Self>
Translates this string into IDNA safe name, encoding to punycode as necessary.
sourcepub fn from_ascii(s: &str) -> ProtoResult<Self>
pub fn from_ascii(s: &str) -> ProtoResult<Self>
Takes the ascii string and returns a new label.
This will return an Error if the label is not an ascii string
sourcepub fn to_lowercase(&self) -> Self
pub fn to_lowercase(&self) -> Self
Converts this label to lowercase
sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Returns true if this label is the wildcard, ‘*’, label
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Returns the raw bytes of the label, this is good for writing to the wire.
See Display
for presentation version (unescaped from punycode, etc)
sourcepub fn eq_ignore_ascii_case(&self, other: &Self) -> bool
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool
Performs the equivalence operation disregarding case
sourcepub fn cmp_with_f<F: LabelCmp>(&self, other: &Self) -> Ordering
pub fn cmp_with_f<F: LabelCmp>(&self, other: &Self) -> Ordering
compares with the other label, ignoring case
sourcepub fn to_utf8(&self) -> String
pub fn to_utf8(&self) -> String
Performs the conversion to utf8 from IDNA as necessary, see fmt
for more details
Trait Implementations
sourceimpl<'a> IntoLabel for &'a Label
impl<'a> IntoLabel for &'a Label
sourcefn into_label(self) -> ProtoResult<Label>
fn into_label(self) -> ProtoResult<Label>
Convert this into Label
sourceimpl IntoLabel for Label
impl IntoLabel for Label
sourcefn into_label(self) -> ProtoResult<Label>
fn into_label(self) -> ProtoResult<Label>
Convert this into Label
sourceimpl Ord for Label
impl Ord for Label
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<Label> for Label
impl PartialEq<Label> for Label
sourceimpl PartialOrd<Label> for Label
impl PartialOrd<Label> for Label
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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
impl Eq for Label
impl StructuralEq for Label
Auto Trait Implementations
impl RefUnwindSafe for Label
impl Send for Label
impl Sync for Label
impl Unpin for Label
impl UnwindSafe for Label
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more