Struct rocket::fairing::Kind [−][src]
pub struct Kind(_);
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.
Methods
impl Kind[src]
impl Kindpub const Attach: Kind
Attach: Kind = Kind(1)
Kind flag representing a request for an 'attach' callback.
pub const Launch: Kind
Launch: Kind = Kind(2)
Kind flag representing a request for a 'launch' callback.
pub const Request: Kind
Request: Kind = Kind(4)
Kind flag representing a request for a 'request' callback.
pub const Response: Kind
Response: Kind = Kind(8)
Kind flag representing a request for a 'response' callback.
pub fn is(self, other: Kind) -> bool[src]
pub fn is(self, other: Kind) -> boolReturns 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));
pub fn is_exactly(self, other: Kind) -> bool[src]
pub fn is_exactly(self, other: Kind) -> boolReturns 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 Debug for Kind[src]
impl Debug for Kindfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for Kind[src]
impl Clone for Kindfn clone(&self) -> Kind[src]
fn clone(&self) -> KindReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Copy for Kind[src]
impl Copy for Kindimpl BitOr for Kind[src]
impl BitOr for Kind