pub trait OptionsExt<O: MessageOption>: Iterator<Item = O> {
    type IgnoredUriHost: Iterator<Item = O> + Sized;
    type IgnoredUriQuery: Iterator<Item = O> + Sized;
    type WithoutBlock2<'a>: Iterator<Item = O>
       where Self: 'a;
    type WithoutUriPath<F: FnMut(&str)>: Iterator<Item = O>;

    // Required methods
    fn ignore_uri_host(self) -> Self::IgnoredUriHost;
    fn ignore_uri_query(self) -> Self::IgnoredUriQuery;
    fn ignore_elective_others(self) -> Result<(), BadOption>;
    fn take_block2<'a>(
        self,
        out: &'a mut Option<Block2RequestData>
    ) -> Self::WithoutBlock2<'a>
       where Self: 'a;
    fn take_uri_path<F: FnMut(&str)>(self, f: F) -> Self::WithoutUriPath<F>;
}
Expand description

Extensions implemented for any MessageOption iterator to enable simple and direct use

See module level documentation for examples.

Required Associated Types§

source

type IgnoredUriHost: Iterator<Item = O> + Sized

source

type IgnoredUriQuery: Iterator<Item = O> + Sized

source

type WithoutBlock2<'a>: Iterator<Item = O> where Self: 'a

source

type WithoutUriPath<F: FnMut(&str)>: Iterator<Item = O>

Required Methods§

source

fn ignore_uri_host(self) -> Self::IgnoredUriHost

Remove Uri-Host option from the iterator

Note that not processing this may be inappropriate for security reasons, especially with security models that otherwise require DNS rebinding protection.

source

fn ignore_uri_query(self) -> Self::IgnoredUriQuery

Remove Uri-Query options from the iterator

Note that this is not something that should simply be placed in a handler; it should only be used if the definition of the resource’s interface explicitly allows the implementation to ignore unknown query parameters.

source

fn ignore_elective_others(self) -> Result<(), BadOption>

Exhaust the iterator, successfully if no critical options are present, or indicating an error if critical options were not processed before.

source

fn take_block2<'a>( self, out: &'a mut Option<Block2RequestData> ) -> Self::WithoutBlock2<'a>where Self: 'a,

Set out to the parsed value of the found Block2 option, and return an iterator over the remaining options.

Unparsable or repeated Block2 options are left in the output, leaving the error to show up in the eventual ignore_elective_others call.

source

fn take_uri_path<F: FnMut(&str)>(self, f: F) -> Self::WithoutUriPath<F>

Call a function (that typically cranks some path state machine) on every (valid) Uri-Path option in an iterator, hiding them from further iteration.

Error handling of the UTF8 decoding is done by not removing invalid options from the iterator, thus leaving them for an eventual ignore_elective_others.

Implementors§

source§

impl<T, O> OptionsExt<O> for Twhere T: Iterator<Item = O>, O: MessageOption,

§

type IgnoredUriHost = Filter<T, fn(_: &O) -> bool>

§

type IgnoredUriQuery = Filter<T, fn(_: &O) -> bool>

§

type WithoutBlock2<'a> where T: 'a = BlockPusher<'a, O, T>

§

type WithoutUriPath<F: FnMut(&str)> = UriPusher<O, T, F>