pub struct Data<T = Bytes> {
stream_id: StreamId,
data: T,
flags: DataFlags,
pad_len: Option<u8>,
}
Expand description
Data frame
Data frames convey arbitrary, variable-length sequences of octets associated with a stream. One or more DATA frames are used, for instance, to carry HTTP request or response payloads.
Fields§
§stream_id: StreamId
§data: T
§flags: DataFlags
§pad_len: Option<u8>
Implementations§
source§impl<T> Data<T>
impl<T> Data<T>
sourcepub fn stream_id(&self) -> StreamId
pub fn stream_id(&self) -> StreamId
Returns the stream identifier that this frame is associated with.
This cannot be a zero stream identifier.
sourcepub fn is_end_stream(&self) -> bool
pub fn is_end_stream(&self) -> bool
Gets the value of the END_STREAM
flag for this frame.
If true, this frame is the last that the endpoint will send for the identified stream.
Setting this flag causes the stream to enter one of the “half-closed” states or the “closed” state (Section 5.1).
sourcepub fn set_end_stream(&mut self, val: bool)
pub fn set_end_stream(&mut self, val: bool)
Sets the value for the END_STREAM
flag on this frame.
sourcepub fn payload(&self) -> &T
pub fn payload(&self) -> &T
Returns a reference to this frame’s payload.
This does not include any padding that might have been originally included.
sourcepub fn payload_mut(&mut self) -> &mut T
pub fn payload_mut(&mut self) -> &mut T
Returns a mutable reference to this frame’s payload.
This does not include any padding that might have been originally included.
sourcepub fn into_payload(self) -> T
pub fn into_payload(self) -> T
Consumes self
and returns the frame’s payload.
This does not include any padding that might have been originally included.
pub(crate) fn head(&self) -> Head
pub(crate) fn map<F, U>(self, f: F) -> Data<U>where
F: FnOnce(T) -> U,
Trait Implementations§
source§impl<T: PartialEq> PartialEq for Data<T>
impl<T: PartialEq> PartialEq for Data<T>
impl<T: Eq> Eq for Data<T>
impl<T> StructuralPartialEq for Data<T>
Auto Trait Implementations§
impl<T> Freeze for Data<T>where
T: Freeze,
impl<T> RefUnwindSafe for Data<T>where
T: RefUnwindSafe,
impl<T> Send for Data<T>where
T: Send,
impl<T> Sync for Data<T>where
T: Sync,
impl<T> Unpin for Data<T>where
T: Unpin,
impl<T> UnwindSafe for Data<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.