Enum Frame

Source
pub enum Frame {
    PayloadFrame(PayloadFrame),
    Cancel(Cancel),
    ErrorFrame(ErrorFrame),
    RequestN(RequestN),
    RequestResponse(RequestResponse),
    RequestFnF(RequestFnF),
    RequestStream(RequestStream),
    RequestChannel(RequestChannel),
}
Expand description

An enum that can hold any time of wasmrs frame.

Variants§

§

PayloadFrame(PayloadFrame)

§

Cancel(Cancel)

§

ErrorFrame(ErrorFrame)

§

RequestN(RequestN)

§

RequestResponse(RequestResponse)

§

RequestFnF(RequestFnF)

§

RequestStream(RequestStream)

§

RequestChannel(RequestChannel)

Implementations§

Source§

impl Frame

Source

pub const FLAG_IGNORE: u16 = 16u16

The IGNORE bit

Source

pub const FLAG_NEXT: u16 = 32u16

The NEXT bit

Source

pub const FLAG_COMPLETE: u16 = 64u16

The COMPLETE bit

Source

pub const FLAG_FOLLOW: u16 = 128u16

The FOLLOW bit

Source

pub const FLAG_METADATA: u16 = 256u16

The METADATA bit

Source

pub const REQUEST_MAX: u32 = 2_147_483_647u32

The maximum number of N for RequestN

Source

pub fn stream_id(&self) -> u32

Get the stream id for the frame.

Source

pub fn get_flag(&self) -> u16

Get the set flags for the frame.

Source

pub fn frame_type(&self) -> FrameType

Get the FrameType.

Source

pub fn decode(bytes: Bytes) -> Result<Frame, (u32, Error)>

Decode Bytes into a Frame.

Source

pub fn encode(self) -> Bytes

Encode the Frame into a byte buffer.

Source

pub fn make_v0_metadata(&mut self)

Convert the metadata to v0 metadata.

Source

pub fn new_error(stream_id: u32, e: PayloadError) -> Frame

Create a new [ErrorFrame].

Source

pub fn new_cancel(stream_id: u32) -> Frame

Create a new [Cancel] frame.

Source

pub fn new_request_n(stream_id: u32, n: u32, _flags: u16) -> Frame

Create a new [RequestN] frame.

Source

pub fn new_request_response( stream_id: u32, payload: RawPayload, flags: u16, ) -> Frame

Create a new [RequestResponse] frame.

Source

pub fn new_request_stream( stream_id: u32, payload: RawPayload, flags: u16, ) -> Frame

Create a new [RequestStream] frame.

Source

pub fn new_request_channel( stream_id: u32, payload: RawPayload, flags: u16, initial_n: u32, ) -> Frame

Create a new [RequestChannel] frame.

Source

pub fn new_request_fnf(stream_id: u32, payload: RawPayload, flags: u16) -> Frame

Create a new [RequestFnF] (Fire & Forget) frame

Source

pub fn new_payload(stream_id: u32, payload: RawPayload, flags: u16) -> Frame

Create a new [PayloadFrame].

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<Frame> for Result<Option<RawPayload>, PayloadError>

Source§

fn from(frame: Frame) -> Result<Option<RawPayload>, PayloadError>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S> ConditionallySend for S
where S: Send + 'static,

Source§

impl<S> ConditionallySendSync for S
where S: Send + Sync + 'static,