Trait domain::base::name::ToLabelIter

source ·
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§

source

type LabelIter<'a>: Iterator<Item = &'a Label> + DoubleEndedIterator + Clone where Self: 'a

The type of the iterator over the labels.

This iterator types needs to be double ended so that we can deal with name suffixes. It needs to be cloneable to be able to cascade over parents of a name.

Required Methods§

source

fn iter_labels(&self) -> Self::LabelIter<'_>

Returns an iterator over the labels.

Provided Methods§

source

fn compose_len(&self) -> u16

Returns the length in octets of the encoded name.

source

fn starts_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool

Determines whether base is a prefix of self.

source

fn ends_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool

Determines whether base is a suffix of self.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'r, N: ToLabelIter + ?Sized> ToLabelIter for &'r N

source§

type LabelIter<'a> = <N as ToLabelIter>::LabelIter<'a> where N: 'a, 'r: 'a

source§

fn iter_labels(&self) -> Self::LabelIter<'_>

Implementors§

source§

impl<L: ToRelativeName, R: ToLabelIter> ToLabelIter for Chain<L, R>

source§

type LabelIter<'a> = ChainIter<'a, L, R> where L: 'a, R: 'a

source§

impl<Octs> ToLabelIter for Name<Octs>
where Octs: AsRef<[u8]> + ?Sized,

source§

type LabelIter<'a> = NameIter<'a> where Octs: 'a

source§

impl<Octs> ToLabelIter for RelativeName<Octs>
where Octs: AsRef<[u8]> + ?Sized,

source§

type LabelIter<'a> = NameIter<'a> where Octs: 'a

source§

impl<Octs, R> ToLabelIter for Chain<UncertainName<Octs>, R>
where Octs: AsRef<[u8]>, R: ToName,

source§

type LabelIter<'a> = UncertainChainIter<'a, Octs, R> where Octs: 'a, R: 'a

source§

impl<Octs: AsRef<[u8]>> ToLabelIter for UncertainName<Octs>

source§

type LabelIter<'a> = NameIter<'a> where Octs: 'a

source§

impl<Octs: AsRef<[u8]>> ToLabelIter for ParsedName<Octs>

source§

type LabelIter<'s> = ParsedNameIter<'s> where Octs: 's