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 ToDname and ToRelativeDname. 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.

ToRelativeDname: trait ToRelativeDname.html

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.

Implementations on Foreign Types§

source§

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

§

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

source§

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

Implementors§

source§

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

§

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

source§

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

§

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

source§

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

§

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

source§

impl<Octs, R> ToLabelIter for Chain<UncertainDname<Octs>, R>where Octs: AsRef<[u8]>, R: ToDname,

§

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

source§

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

§

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

source§

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

§

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