pub struct Kind(_);
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:
- Ignite
- Liftoff
- Request
- Response
- Shutdown
Two Kind
structures can be or
d together to represent a combination. For
instance, to represent a fairing that is both an ignite and request fairing,
use Kind::Ignite | Kind::Request
. Similarly, to represent a fairing that
is only an ignite fairing, use Kind::Ignite
.
Additionally, a fairing can request to be treated as a
singleton by specifying the
Singleton
kind.
Implementations
sourceimpl Kind
impl Kind
sourcepub const Ignite: Kind = Kind(1 << 0)
pub const Ignite: Kind = Kind(1 << 0)
Kind
flag representing a request for a ‘ignite’ callback.
sourcepub const Liftoff: Kind = Kind(1 << 1)
pub const Liftoff: Kind = Kind(1 << 1)
Kind
flag representing a request for a ‘liftoff’ callback.
sourcepub const Request: Kind = Kind(1 << 2)
pub const Request: Kind = Kind(1 << 2)
Kind
flag representing a request for a ‘request’ callback.
sourcepub const Response: Kind = Kind(1 << 3)
pub const Response: Kind = Kind(1 << 3)
Kind
flag representing a request for a ‘response’ callback.
sourcepub const Shutdown: Kind = Kind(1 << 4)
pub const Shutdown: Kind = Kind(1 << 4)
Kind
flag representing a request for a ‘shutdown’ callback.
sourcepub fn is(self, other: Kind) -> bool
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 ignite_and_req = Kind::Ignite | Kind::Request;
assert!(ignite_and_req.is(Kind::Ignite | Kind::Request));
assert!(ignite_and_req.is(Kind::Ignite));
assert!(ignite_and_req.is(Kind::Request));
assert!(!ignite_and_req.is(Kind::Liftoff));
assert!(!ignite_and_req.is(Kind::Response));
assert!(!ignite_and_req.is(Kind::Ignite | Kind::Response));
assert!(!ignite_and_req.is(Kind::Ignite | Kind::Request | Kind::Response));
sourcepub fn is_exactly(self, other: Kind) -> bool
pub fn is_exactly(self, other: Kind) -> bool
Returns true
if self
is exactly other
.
Example
use rocket::fairing::Kind;
let ignite_and_req = Kind::Ignite | Kind::Request;
assert!(ignite_and_req.is_exactly(Kind::Ignite | Kind::Request));
assert!(!ignite_and_req.is_exactly(Kind::Ignite));
assert!(!ignite_and_req.is_exactly(Kind::Request));
assert!(!ignite_and_req.is_exactly(Kind::Response));
assert!(!ignite_and_req.is_exactly(Kind::Ignite | Kind::Response));
Trait Implementations
impl Copy for Kind
Auto Trait Implementations
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnwindSafe for Kind
Blanket Implementations
impl<'a, T> AsTaggedExplicit<'a> for T where
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for T where
T: 'a,
fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self>
impl<'a, T> AsTaggedImplicit<'a> for T where
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for T where
T: 'a,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
sourcefn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = 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>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more