Trait OptionIteratorExt

Source
pub trait OptionIteratorExt<'a>: Iterator<Item = Result<(OptionNumber, &'a [u8]), Error>> {
    // Required method
    fn find_next(
        &mut self,
        key: OptionNumber,
    ) -> Option<Result<(OptionNumber, &'a [u8]), Error>>;

    // Provided methods
    fn find_next_of<T>(&mut self, key: OptionKey<T>) -> Option<Result<T, Error>>
       where T: TryOptionValueFrom<'a> + Sized { ... }
    fn extract_uri(&self) -> Result<RelRefBuf, Error>
       where Self: Sized + Clone { ... }
    fn extract_location(&self) -> Result<RelRefBuf, Error>
       where Self: Sized + Clone { ... }
}
Expand description

Extension trait for option iterators that provide additional convenient accessors.

Required Methods§

Source

fn find_next( &mut self, key: OptionNumber, ) -> Option<Result<(OptionNumber, &'a [u8]), Error>>

Moves the iterator forward until it finds a matching key or the spot where it should have been.

If found, returns the option number and a byte slice of the value.

Does not consume any options after the matching key.

Provided Methods§

Source

fn find_next_of<T>(&mut self, key: OptionKey<T>) -> Option<Result<T, Error>>
where T: TryOptionValueFrom<'a> + Sized,

Typed version of OptionIteratorExt::find_next.

Moves the iterator forward until it finds a matching key or the spot where it should have been.

If found, returns the value of the option key.

Does not consume any options after the matching key.

Source

fn extract_uri(&self) -> Result<RelRefBuf, Error>
where Self: Sized + Clone,

Extracts a URI relative-reference from the remaining URI_PATH and URI_QUERY options, moving the iterator past them.

Source

fn extract_location(&self) -> Result<RelRefBuf, Error>
where Self: Sized + Clone,

Extracts a URI relative-reference from the remaining LOCATION_PATH and LOCATION_QUERY options, moving the iterator past them.

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.

Implementors§

Source§

impl<'a, I> OptionIteratorExt<'a> for I
where I: Iterator<Item = Result<(OptionNumber, &'a [u8]), Error>> + Sized + Clone,