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§
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§
sourcefn ignore_uri_host(self) -> Self::IgnoredUriHost
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.
sourcefn ignore_uri_query(self) -> Self::IgnoredUriQuery
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.
sourcefn ignore_elective_others(self) -> Result<(), BadOption>
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.
sourcefn take_block2<'a>(
self,
out: &'a mut Option<Block2RequestData>
) -> Self::WithoutBlock2<'a>where
Self: 'a,
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.
sourcefn take_uri_path<F: FnMut(&str)>(self, f: F) -> Self::WithoutUriPath<F>
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.