pub struct HttpRequestBody(pub Bytes);Expand description
Raw HTTP request body bytes injected into the Bus for body-aware routes.
Populated automatically when using .post_body(), .put_body(), or .patch_body().
Access inside a transition via bus.read::<HttpRequestBody>().
§Example
ⓘ
use ranvier_http::prelude::*;
// In a transition:
let body_bytes = bus.read::<HttpRequestBody>()
.map(|b| b.as_bytes())
.unwrap_or_default();Tuple Fields§
§0: BytesImplementations§
Source§impl HttpRequestBody
impl HttpRequestBody
Sourcepub fn parse_json<T: DeserializeOwned>(&self) -> Result<T, ExtractError>
pub fn parse_json<T: DeserializeOwned>(&self) -> Result<T, ExtractError>
Parse the body as JSON.
Trait Implementations§
Source§impl Clone for HttpRequestBody
impl Clone for HttpRequestBody
Source§fn clone(&self) -> HttpRequestBody
fn clone(&self) -> HttpRequestBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for HttpRequestBody
impl RefUnwindSafe for HttpRequestBody
impl Send for HttpRequestBody
impl Sync for HttpRequestBody
impl Unpin for HttpRequestBody
impl UnsafeUnpin for HttpRequestBody
impl UnwindSafe for HttpRequestBody
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
Mutably borrows from an owned value. Read more