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>;
    type WithoutUriPath<'a, F: FnMut(&str)>: Iterator<Item = O>;

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

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

See module level documentation for examples.

Required Associated Types

Required Methods

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.

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.

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

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.

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