Enum LookupControlFlow

Source
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 Authority

  • All authorities should default to using LookupControlFlow::Continue to wrap their responses. These responses may be passed to other authorities for analysis or requery purposes.
  • Authorities may use LookupControlFlow::Break to indicate the response must be returned immediately to the client, without consulting any other authorities. For example, if the the user configures a blocklist authority, it would not be appropriate to pass the query to any additional authorities to try to resolve, as that might be used to leak information to a hostile party, and so a blocklist (or similar) authority should wrap responses for any blocklist hits in LookupControlFlow::Break.
  • Authorities may use LookupControlFlow::Skip to indicate the authority did not attempt to process a particular query. This might be used, for example, in a block list authority 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 authorities 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 authorities.

§

Skip

The authority did not answer the query and the next authority 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 (authority lookup functions previously returned a Result over a Lookup or LookupError type.)

Source

pub fn is_continue(&self) -> bool

Return true if self is LookupControlFlow::Continue

Source

pub fn is_break(&self) -> bool

Return true if self is LookupControlFlow::Break

Source

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<T: LookupObject + 'static, E: Display> LookupControlFlow<T, E>

Source

pub fn expect(self, msg: &str) -> T

Return inner Ok variant or panic with a custom error message.

Source

pub fn expect_err(self, msg: &str) -> E

Return inner Err variant or panic with a custom error message.

Source

pub fn unwrap(self) -> T

Return inner Ok variant or panic

Source

pub fn unwrap_err(self) -> E

Return inner Err variant or panic

Source

pub fn unwrap_or_default(self) -> T
where T: Default,

Return inner Ok Variant or default value

Source

pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> LookupControlFlow<U, E>

Maps inner Ok(T) to Ok(U), passing inner Err and Skip values unchanged.

Source

pub fn map_dyn(self) -> LookupControlFlow<Box<dyn LookupObject>, E>

Maps inner Ok(T) to Ok(Box<dyn LookupObject>), passing inner Err and Skip values unchanged.

Source

pub fn map_err<U, F: FnOnce(E) -> U>(self, op: F) -> LookupControlFlow<T, U>

Maps inner Err(T) to Err(U), passing Ok and Skip values unchanged.

Trait Implementations§

Source§

impl<T, E> Display for LookupControlFlow<T, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for LookupControlFlow<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for LookupControlFlow<T, E>

§

impl<T, E> Send for LookupControlFlow<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for LookupControlFlow<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for LookupControlFlow<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for LookupControlFlow<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T