rocket::fairing

Struct Kind

Source
pub struct Kind(/* private fields */);
Expand description

A bitset representing the kinds of callbacks a Fairing wishes to receive.

A fairing can request any combination of any of the following kinds of callbacks:

  • Attach
  • Launch
  • Request
  • Response

Two Kind structures can be ord together to represent a combination. For instance, to represent a fairing that is both a launch and request fairing, use Kind::Launch | Kind::Request. Similarly, to represent a fairing that is only an attach fairing, use Kind::Attach.

Implementations§

Source§

impl Kind

Source

pub const Attach: Kind = _

Kind flag representing a request for an ‘attach’ callback.

Source

pub const Launch: Kind = _

Kind flag representing a request for a ‘launch’ callback.

Source

pub const Request: Kind = _

Kind flag representing a request for a ‘request’ callback.

Source

pub const Response: Kind = _

Kind flag representing a request for a ‘response’ callback.

Source

pub fn is(self, other: Kind) -> bool

Returns true if self is a superset of other. In other words, returns true if all of the kinds in other are also in self.

§Example
use rocket::fairing::Kind;

let launch_and_req = Kind::Launch | Kind::Request;
assert!(launch_and_req.is(Kind::Launch | Kind::Request));

assert!(launch_and_req.is(Kind::Launch));
assert!(launch_and_req.is(Kind::Request));

assert!(!launch_and_req.is(Kind::Response));
assert!(!launch_and_req.is(Kind::Launch | Kind::Response));
assert!(!launch_and_req.is(Kind::Launch | Kind::Request | Kind::Response));
Source

pub fn is_exactly(self, other: Kind) -> bool

Returns true if self is exactly other.

§Example
use rocket::fairing::Kind;

let launch_and_req = Kind::Launch | Kind::Request;
assert!(launch_and_req.is_exactly(Kind::Launch | Kind::Request));

assert!(!launch_and_req.is_exactly(Kind::Launch));
assert!(!launch_and_req.is_exactly(Kind::Request));
assert!(!launch_and_req.is_exactly(Kind::Response));
assert!(!launch_and_req.is_exactly(Kind::Launch | Kind::Response));

Trait Implementations§

Source§

impl BitOr for Kind

Source§

type Output = Kind

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
Source§

impl Clone for Kind

Source§

fn clone(&self) -> Kind

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Kind

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Copy for Kind

Auto Trait Implementations§

§

impl Freeze for Kind

§

impl RefUnwindSafe for Kind

§

impl Send for Kind

§

impl Sync for Kind

§

impl Unpin for Kind

§

impl UnwindSafe for Kind

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, I> AsResult<T, I> for T
where I: Input,

Source§

fn as_result(self) -> Result<T, ParseErr<I>>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

§

impl<T> IntoCollection<T> for T

§

fn into_collection<A>(self) -> SmallVec<A>
where A: Array<Item = T>,

Converts self into a collection.
§

fn mapped<U, F, A>(self, f: F) -> SmallVec<A>
where F: FnMut(T) -> U, A: Array<Item = U>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<T> Typeable for T
where T: Any,

Source§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
Source§

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

Source§

fn vzip(self) -> V