Skip to main content

HttpBodyControl

Trait HttpBodyControl 

Source
pub trait HttpBodyControl: HttpControl {
    // Required method
    fn body_size(&self) -> usize;

    // Provided methods
    fn get(&self, range: impl RangeBounds<usize>) -> Option<Vec<u8>> { ... }
    fn set(&self, range: impl RangeBounds<usize>, value: &[u8]) { ... }
    fn all(&self) -> Option<Vec<u8>> { ... }
    fn replace(&self, value: &[u8]) { ... }
    fn clear(&self) { ... }
}
Expand description

Defines functions to interact with body data

Required Methods§

Source

fn body_size(&self) -> usize

Length of this body fragment

Provided Methods§

Source

fn get(&self, range: impl RangeBounds<usize>) -> Option<Vec<u8>>

Get a range of the body block content

Source

fn set(&self, range: impl RangeBounds<usize>, value: &[u8])

Set a range of the body block content

Source

fn all(&self) -> Option<Vec<u8>>

Get the entire body block content

Source

fn replace(&self, value: &[u8])

Replace the entire body block with value

Source

fn clear(&self)

Clear the entire body block

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§