[][src]Struct neli::iter::NlMessageIter

pub struct NlMessageIter<'a, T, P> { /* fields omitted */ }

Iterator over messages in an NlSocketHandle type.

This iterator has two high-level options:

  • Iterate indefinitely over messages. This is most useful in the case of subscribing to messages in a multicast group.
  • Iterate until a message is returned with Nlmsg::Done is set. This is most useful in the case of request-response workflows where the iterator will parse and iterate through all of the messages with NlmF::Multi set until a message with Nlmsg::Done is received at which point None will be returned indicating the end of the response.

Implementations

impl<'a, T, P> NlMessageIter<'a, T, P> where
    T: Nl + NlType + Debug,
    P: Nl + Debug
[src]

pub fn new(
    sock_ref: &'a mut NlSocketHandle,
    behavior: IterationBehavior
) -> Self
[src]

Construct a new iterator that yields Nlmsghdr structs from the provided buffer. behavior set to IterationBehavior::IterIndefinitely will treat messages as a never-ending stream. IterationBehavior::EndMultiOnDone will cause NlMessageIter to respect the netlink identifiers NlmF::Multi and Nlmsg::Done.

If behavior is IterationBehavior::EndMultiOnDone, this means that NlMessageIter will iterate through either exactly one message if NlmF::Multi is not set, or through all consecutive messages with NlmF::Multi set until a terminating message with Nlmsg::Done is reached at which point None will be returned by the iterator.

Trait Implementations

impl<'a, P> Iterator for NlMessageIter<'a, NlTypeWrapper, P> where
    P: Nl + Debug
[src]

type Item = Result<Nlmsghdr<NlTypeWrapper, P>, NlError>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, T, P> !RefUnwindSafe for NlMessageIter<'a, T, P>[src]

impl<'a, T, P> Send for NlMessageIter<'a, T, P> where
    P: Send,
    T: Send
[src]

impl<'a, T, P> !Sync for NlMessageIter<'a, T, P>[src]

impl<'a, T, P> Unpin for NlMessageIter<'a, T, P> where
    P: Unpin,
    T: Unpin
[src]

impl<'a, T, P> !UnwindSafe for NlMessageIter<'a, T, P>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.