Trait ToLabelIter

Source
pub trait ToLabelIter<'a> {
    type LabelIter: Iterator<Item = &'a Label> + DoubleEndedIterator;

    // Required method
    fn iter_labels(&'a self) -> Self::LabelIter;

    // Provided methods
    fn starts_with<N: ToLabelIter<'a>>(&'a self, base: &'a N) -> bool { ... }
    fn ends_with<N: ToLabelIter<'a>>(&'a self, base: &'a 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: Iterator<Item = &'a Label> + DoubleEndedIterator

The type of the iterator over the labels.

This iterator types needs to be double ended so that we can deal with name suffixes.

Required Methods§

Source

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

Returns an iterator over the labels.

Provided Methods§

Source

fn starts_with<N: ToLabelIter<'a>>(&'a self, base: &'a N) -> bool

Determines whether base is a prefix of self.

Source

fn ends_with<N: ToLabelIter<'a>>(&'a self, base: &'a N) -> bool

Determines whether base is a suffix of self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, 'b, N: ToLabelIter<'b>> ToLabelIter<'b> for &'a N

Source§

type LabelIter = <N as ToLabelIter<'b>>::LabelIter

Source§

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

Implementors§