[−][src]Struct fastly::body::BodyHandle
A low-level interface to HTTP bodies.
This type implements Read
to read bytes from the beginning of a body, and Write
to write to
the end of a body. Note that these operations are unbuffered, unlike the same operations on the
higher-level Body
type.
These handles can also be used to append bodies to each other in amortized constant time.
Methods
impl BodyHandle
[src]
pub const INVALID: Self
[src]
pub fn is_invalid(&self) -> bool
[src]
pub fn downstream_request() -> Result<Self, Error>
[src]
Get a handle to the downstream request body.
This handle may only be retrieved once per execution, either through this function or
through fastly::request::downstream_request_and_body_handles()
.
pub fn new() -> Result<BodyHandle, Error>
[src]
Get a handle to a new, empty body.
pub fn append(&mut self, other: BodyHandle) -> Result<(), Error>
[src]
Append another body onto the end of this body.
The other body will no longer be valid after this call.
pub fn into_bytes(self) -> Result<Vec<u8>, Error>
[src]
Read the entirety of the body.
Note that this will involve copying and buffering the body, and so should only be used for convenience on small request bodies.
pub fn into_string(self) -> Result<String, Error>
[src]
Read the entirety of the body into a String
, interpreting the bytes as UTF-8.
Note that this will involve copying and buffering the body, and so should only be used for convenience on small request bodies.
Trait Implementations
impl Debug for BodyHandle
[src]
impl Eq for BodyHandle
[src]
impl From<BodyHandle> for Body
[src]
fn from(handle: BodyHandle) -> Self
[src]
impl Hash for BodyHandle
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<BodyHandle> for BodyHandle
[src]
fn eq(&self, other: &BodyHandle) -> bool
[src]
fn ne(&self, other: &BodyHandle) -> bool
[src]
impl Read for BodyHandle
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut]) -> Result<usize, Error>
1.36.0[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl StructuralEq for BodyHandle
[src]
impl StructuralPartialEq for BodyHandle
[src]
impl<'_> TryFrom<&'_ [u8]> for BodyHandle
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(s: &[u8]) -> Result<Self, Error>
[src]
impl<'_> TryFrom<&'_ str> for BodyHandle
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(s: &str) -> Result<Self, Error>
[src]
impl TryFrom<String> for BodyHandle
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(s: String) -> Result<Self, Error>
[src]
impl TryFrom<Vec<u8>> for BodyHandle
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(s: Vec<u8>) -> Result<Self, Error>
[src]
impl Write for BodyHandle
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>
1.36.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for BodyHandle
impl Send for BodyHandle
impl Sync for BodyHandle
impl Unpin for BodyHandle
impl UnwindSafe for BodyHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,