pub trait OptionsExt<O: MessageOption>: Iterator<Item = O> {
type IgnoredUriHost: Iterator<Item = O> + Sized;
type IgnoredUriQuery: Iterator<Item = O> + Sized;
type WithoutBlock2: Iterator<Item = O>;
type WithoutUriPath: 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;
}Expand description
Extensions implemented for any MessageOption iterator to enable simple and direct use
See module level documentation for examples.
Associated Types
type IgnoredUriHost: Iterator<Item = O> + Sized
type IgnoredUriQuery: Iterator<Item = O> + Sized
type WithoutBlock2: Iterator<Item = O>
type WithoutUriPath: Iterator<Item = O>
Required methods
fn 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.
fn 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.
fn ignore_elective_others(self) -> Result<(), CriticalOptionsRemain>
fn ignore_elective_others(self) -> Result<(), CriticalOptionsRemain>
Exhaust the iterator, successfully if no critical options are present, or indicating an error if critical options were not processed before.
fn take_block2(self, out: &mut Option<Block2RequestData>) -> Self::WithoutBlock2
fn take_block2(self, out: &mut Option<Block2RequestData>) -> Self::WithoutBlock2
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.
fn take_uri_path<'a, F: FnMut(&str)>(self, f: F) -> Self::WithoutUriPath
fn take_uri_path<'a, F: FnMut(&str)>(self, f: F) -> Self::WithoutUriPath
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.