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.

RFC 5389 -- 3. Overview of Operation

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

Methods

impl Class
[src]

Returns a Class instance which is corresponding to value.

A class of 0b00 is a request, a class of 0b01 is an indication, a class of 0b10 is a success response, and a class of 0b11 is an error response.

RFC 5389 -- 6. STUN Message Structure

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]

Formats the value using the given formatter.

impl Clone for Class
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Class
[src]

impl PartialOrd for Class
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

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]

This method returns an Ordering between self and other. Read more

impl PartialEq for Class
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Class
[src]

impl Hash for Class
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.