pub struct LxBytes(pub Bytes);Expand description
A version of Bytes which conforms to Lexe’s (binary) API.
-
axumhas implementations ofFromRequestandIntoResponseforBytes, but these implementations are not Lexe API-conformant. -
This type can be used as either an extractor or a success response, and should always be used instead of
Bytesin these server contexts. -
It is still fine to use
Byteson the client side. -
As an extractor: rejections return
LxRejection. -
As a success response:
-
Returns an
http::Responsewith a binary body. -
Any failure encountered in extraction or creation should produce an
ErrorResponse.
-
The regular impls are non-conformant because:
- Rejections return
BytesRejectionwhich is just a string HTTP body.
NOTE: This must only be used for forming success API responses,
i.e. LxBytes in Result<LxBytes, E>, because its IntoResponse impl
uses StatusCode::OK. Our API error types are serialized as JSON and
have separate IntoResponse impls which return error statuses.
Tuple Fields§
§0: BytesTrait Implementations§
Source§impl IntoResponse for LxBytes
The Bytes IntoResponse impl is almost exactly the same,
except it returns the wrong HTTP version.
impl IntoResponse for LxBytes
The Bytes IntoResponse impl is almost exactly the same,
except it returns the wrong HTTP version.
Source§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Source§impl Ord for LxBytes
impl Ord for LxBytes
Source§impl PartialOrd for LxBytes
impl PartialOrd for LxBytes
impl Eq for LxBytes
impl StructuralPartialEq for LxBytes
Auto Trait Implementations§
impl !Freeze for LxBytes
impl RefUnwindSafe for LxBytes
impl Send for LxBytes
impl Sync for LxBytes
impl Unpin for LxBytes
impl UnsafeUnpin for LxBytes
impl UnwindSafe for LxBytes
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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§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.Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Service by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
MakeService and no state. Read more