Enum rustun::message::Class
[−]
[src]
pub enum Class { Request, Indication, SuccessResponse, ErrorResponse, }
The class of a message.
The class indicates whether this is a request, a success response, an error response, or an indication.
An instance of Class
can be casted to the corresponding u8
value.
use rustun::message::Class; assert_eq!(Class::Request as u8, 0b00); assert_eq!(Class::Indication as u8, 0b01); assert_eq!(Class::SuccessResponse as u8, 0b10); assert_eq!(Class::ErrorResponse as u8, 0b11);
Variants
Request
Indication
SuccessResponse
ErrorResponse
Methods
impl Class
[src]
fn from_u8(value: u8) -> Option<Self>
Returns a Class
instance which is corresponding to value
.
A class of
0b00
is a request, a class of0b01
is an indication, a class of0b10
is a success response, and a class of0b11
is an error response.
If no such instance exists, this will return None
.
Examples
use rustun::message::Class; assert_eq!(Class::from_u8(0), Some(Class::Request)); assert_eq!(Class::from_u8(9), None);
Trait Implementations
impl Debug for Class
[src]
impl Clone for Class
[src]
fn clone(&self) -> Class
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Class
[src]
impl PartialOrd for Class
[src]
fn partial_cmp(&self, __arg_0: &Class) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Class
[src]
fn cmp(&self, __arg_0: &Class) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialEq for Class
[src]
fn eq(&self, __arg_0: &Class) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for Class
[src]
impl Hash for Class
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.