Struct solicit::http::frame::RawFrame [−][src]
pub struct RawFrame { /* fields omitted */ }
A struct that defines the format of the raw HTTP/2 frame, i.e. the frame as it is read from the wire.
This format is defined in section 4.1. of the HTTP/2 spec.
The RawFrame
struct simply stores the raw components of an HTTP/2 frame:
its header and the payload as a sequence of bytes.
It does not try to interpret the payload bytes, nor do any validation in terms of its validity based on the frame type given in the header. It is simply a wrapper around the two parts of an HTTP/2 frame.
Methods
impl RawFrame
[src]
impl RawFrame
pub fn new(header: FrameHeader) -> RawFrame
[src]
pub fn new(header: FrameHeader) -> RawFrame
Creates a new RawFrame
with the given FrameHeader
. The payload is
left empty.
pub fn with_payload(header: FrameHeader, payload: Vec<u8>) -> RawFrame
[src]
pub fn with_payload(header: FrameHeader, payload: Vec<u8>) -> RawFrame
Creates a new RawFrame
with the given header and payload.
Does not do any validation to determine whether the frame is in a correct
state as constructed.
pub fn from_buf(buf: &[u8]) -> Option<RawFrame>
[src]
pub fn from_buf(buf: &[u8]) -> Option<RawFrame>
Creates a new RawFrame
by parsing the given buffer.
Returns
A RawFrame
instance constructed from the given buffer.
If the buffer cannot be parsed into a frame, which includes the payload
section having a different length than what was found in the header,
None
is returned.
pub fn serialize(&self) -> Vec<u8>
[src]
pub fn serialize(&self) -> Vec<u8>
Returns a Vec
of bytes representing the serialized (on-the-wire)
representation of this raw frame.
pub fn header(&self) -> FrameHeader
[src]
pub fn header(&self) -> FrameHeader
Returns a FrameHeader
instance corresponding to the headers of the
RawFrame
.
pub fn payload(&self) -> &[u8]
[src]
pub fn payload(&self) -> &[u8]
Returns a slice representing the payload of the RawFrame
.
Trait Implementations
impl PartialEq for RawFrame
[src]
impl PartialEq for RawFrame
fn eq(&self, other: &RawFrame) -> bool
[src]
fn eq(&self, other: &RawFrame) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &RawFrame) -> bool
[src]
fn ne(&self, other: &RawFrame) -> bool
This method tests for !=
.
impl Debug for RawFrame
[src]
impl Debug for RawFrame
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for RawFrame
[src]
impl Clone for RawFrame
fn clone(&self) -> RawFrame
[src]
fn clone(&self) -> RawFrame
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Into<Vec<u8>> for RawFrame
[src]
impl Into<Vec<u8>> for RawFrame
Provide a conversion into a Vec
.
impl From<Vec<u8>> for RawFrame
[src]
impl From<Vec<u8>> for RawFrame
Provide a conversion from a Vec
.
This conversion is unchecked and could cause the resulting RawFrame
to be an
invalid HTTP/2 frame.