Trait solicit::http::frame::Frame [] [src]

pub trait Frame: Sized {
    type FlagType: Flag;
    fn from_raw(raw_frame: RawFrame) -> Option<Self>;
    fn is_set(&self, flag: Self::FlagType) -> bool;
    fn get_stream_id(&self) -> StreamId;
    fn get_header(&self) -> FrameHeader;
    fn set_flag(&mut self, flag: Self::FlagType);
    fn serialize(&self) -> Vec<u8>;
}

A trait that all HTTP/2 frame structs need to implement.

Associated Types

type FlagType: Flag

The type that represents the flags that the particular Frame can take. This makes sure that only valid Flags are used with each Frame.

Required Methods

fn from_raw(raw_frame: RawFrame) -> Option<Self>

Creates a new Frame from the given RawFrame (i.e. header and payload), if possible.

Returns

None if a valid Frame cannot be constructed from the given RawFrame. Some reasons why this may happen is a wrong frame type in the header, a body that cannot be decoded according to the particular frame's rules, etc.

Otherwise, returns a newly constructed Frame.

fn is_set(&self, flag: Self::FlagType) -> bool

Tests if the given flag is set for the frame.

fn get_stream_id(&self) -> StreamId

Returns the StreamId of the stream to which the frame is associated

fn get_header(&self) -> FrameHeader

Returns a FrameHeader based on the current state of the Frame.

fn set_flag(&mut self, flag: Self::FlagType)

Sets the given flag for the frame.

fn serialize(&self) -> Vec<u8>

Returns a Vec with the serialized representation of the frame.

Implementors