Struct rocket::fairing::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

§

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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