pub enum LookupControlFlow<T, E = LookupError> {
Continue(Result<T, E>),
Break(Result<T, E>),
Skip,
}Expand description
Result of a Lookup in the Catalog and ZoneHandler
- All zone handlers should default to using LookupControlFlow::Continue to wrap their responses. These responses may be passed to other zone handlers for analysis or requery purposes.
- Zone handlers may use LookupControlFlow::Break to indicate the response must be returned immediately to the client, without consulting any other zone handlers. For example, if the user configures a blocklist zone handler, it would not be appropriate to pass the query to any additional zone handlers to try to resolve, as that might be used to leak information to a hostile party, and so a blocklist (or similar) zone handler should wrap responses for any blocklist hits in LookupControlFlow::Break.
- Zone handlers may use LookupControlFlow::Skip to indicate the zone handler did not attempt to process a particular query. This might be used, for example, in a block list zone handler for any queries that did not match the blocklist, to allow the recursor or forwarder to resolve the query. Skip must not be used to represent an empty lookup; (use Continue(EmptyLookup) or Break(EmptyLookup) for that.)
Variants§
Continue(Result<T, E>)
A lookup response that may be passed to one or more additional zone handlers before being returned to the client.
Break(Result<T, E>)
A lookup response that must be immediately returned to the client without consulting any other zone handlers.
Skip
The zone handler did not answer the query and the next zone handler in the chain should be consulted.
Implementations§
Source§impl<T, E> LookupControlFlow<T, E>
The following are a minimal set of methods typically used with Result or Option, and that
were used in the server code or test suite prior to when the LookupControlFlow type was created
(zone handler lookup functions previously returned a Result over a Lookup or LookupError type.)
impl<T, E> LookupControlFlow<T, E>
The following are a minimal set of methods typically used with Result or Option, and that were used in the server code or test suite prior to when the LookupControlFlow type was created (zone handler lookup functions previously returned a Result over a Lookup or LookupError type.)
Sourcepub fn is_continue(&self) -> bool
pub fn is_continue(&self) -> bool
Return true if self is LookupControlFlow::Continue
Sourcepub fn map_result(self) -> Option<Result<T, E>>
pub fn map_result(self) -> Option<Result<T, E>>
Maps inner Ok(T) and Err(E) to Some(Result<T,E>) and Skip to None
Source§impl<E: Display> LookupControlFlow<AuthLookup, E>
impl<E: Display> LookupControlFlow<AuthLookup, E>
Sourcepub fn expect(self, msg: &str) -> AuthLookup
pub fn expect(self, msg: &str) -> AuthLookup
Return inner Ok variant or panic with a custom error message.
Sourcepub fn expect_err(self, msg: &str) -> E
pub fn expect_err(self, msg: &str) -> E
Return inner Err variant or panic with a custom error message.
Sourcepub fn unwrap(self) -> AuthLookup
pub fn unwrap(self) -> AuthLookup
Return inner Ok variant or panic
Sourcepub fn unwrap_err(self) -> E
pub fn unwrap_err(self) -> E
Return inner Err variant or panic
Sourcepub fn unwrap_or_default(self) -> AuthLookup
pub fn unwrap_or_default(self) -> AuthLookup
Return inner Ok Variant or default value
Sourcepub fn map<U, F: FnOnce(AuthLookup) -> U>(
self,
op: F,
) -> LookupControlFlow<U, E>
pub fn map<U, F: FnOnce(AuthLookup) -> U>( self, op: F, ) -> LookupControlFlow<U, E>
Maps inner Ok(T) to Ok(U), passing inner Err and Skip values unchanged.
Sourcepub fn map_err<U, F: FnOnce(E) -> U>(
self,
op: F,
) -> LookupControlFlow<AuthLookup, U>
pub fn map_err<U, F: FnOnce(E) -> U>( self, op: F, ) -> LookupControlFlow<AuthLookup, U>
Maps inner Err(T) to Err(U), passing Ok and Skip values unchanged.
Trait Implementations§
Auto Trait Implementations§
impl<T, E> Freeze for LookupControlFlow<T, E>
impl<T, E> RefUnwindSafe for LookupControlFlow<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for LookupControlFlow<T, E>
impl<T, E> Sync for LookupControlFlow<T, E>
impl<T, E> Unpin for LookupControlFlow<T, E>
impl<T, E> UnsafeUnpin for LookupControlFlow<T, E>where
T: UnsafeUnpin,
E: UnsafeUnpin,
impl<T, E> UnwindSafe for LookupControlFlow<T, E>where
T: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more