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:
- Attach
- Launch
- Request
- Response
Two Kind
structures can be or
d 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
sourceimpl Kind
impl Kind
sourcepub const Attach: Kind = Kind(0b0001)
pub const Attach: Kind = Kind(0b0001)
Kind
flag representing a request for an ‘attach’ callback.
sourcepub const Launch: Kind = Kind(0b0010)
pub const Launch: Kind = Kind(0b0010)
Kind
flag representing a request for a ‘launch’ callback.
sourcepub const Request: Kind = Kind(0b0100)
pub const Request: Kind = Kind(0b0100)
Kind
flag representing a request for a ‘request’ callback.
sourcepub const Response: Kind = Kind(0b1000)
pub const Response: Kind = Kind(0b1000)
Kind
flag representing a request for a ‘response’ 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 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));
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 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
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
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> 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