Trait rustun::method::Method [] [src]

pub trait Method: Sized {
    fn from_u12(codepoint: U12) -> Option<Self>;
    fn as_u12(&self) -> U12;

    fn request<A>(self) -> Request<Self, A> where Self: Requestable, A: Attribute { ... }
    fn indication<A>(self) -> Indication<Self, A> where Self: Indicatable, A: Attribute { ... }
}

STUN method.

All STUN messages start with a fixed header that includes a method, a class, and the transaction ID. The method indicates which of the various requests or indications this is;

RFC 5389 -- 3. Overview of Operation

Required Methods

Tries to convert from codepoint to the corresponding method.

If no such method exists, this will return None.

Examples

use rustun::Method;
use rustun::rfc5389::methods::Binding;
use rustun::types::U12;

assert!(Binding::from_u12(U12::from_u8(1)).is_some());
assert!(Binding::from_u12(U12::from_u8(0)).is_none());

Returns the codepoint corresponding this method.

Example

use rustun::Method;
use rustun::rfc5389::methods::Binding;
use rustun::types::U12;

assert_eq!(Binding.as_u12(), U12::from_u8(1));

Provided Methods

Makes a request message which have this method.

Makes a indication message which have this method.

Implementors