pub trait ToLabelIter {
type LabelIter<'a>: Iterator<Item = &'a Label> + DoubleEndedIterator + Clone
where Self: 'a;
// Required method
fn iter_labels(&self) -> Self::LabelIter<'_>;
// Provided methods
fn compose_len(&self) -> u16 { ... }
fn starts_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool { ... }
fn ends_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool { ... }
}
Expand description
A type that can produce an iterator over its labels.
This trait is used as a trait bound for both ToName
and
ToRelativeName
. It is separate since it has to be generic over the
lifetime of the label reference but we don’t want to have this lifetime
parameter pollute those traits.
Required Associated Types§
Required Methods§
sourcefn iter_labels(&self) -> Self::LabelIter<'_>
fn iter_labels(&self) -> Self::LabelIter<'_>
Returns an iterator over the labels.
Provided Methods§
sourcefn compose_len(&self) -> u16
fn compose_len(&self) -> u16
Returns the length in octets of the encoded name.
sourcefn starts_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool
fn starts_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool
Determines whether base
is a prefix of self
.
Object Safety§
This trait is not object safe.