Struct distant_net::common::UntypedRequest
source · Expand description
Represents a request to send whose payload is bytes instead of a specific type
Fields
id: Cow<'a, str>Unique id associated with the request
payload: Cow<'a, [u8]>Payload associated with the request as bytes
Implementations
sourceimpl<'a> UntypedRequest<'a>
impl<'a> UntypedRequest<'a>
sourcepub fn to_typed_request<T: DeserializeOwned>(&self) -> Result<Request<T>>
pub fn to_typed_request<T: DeserializeOwned>(&self) -> Result<Request<T>>
Attempts to convert an untyped request to a typed request
sourcepub fn as_borrowed(&self) -> UntypedRequest<'_>
pub fn as_borrowed(&self) -> UntypedRequest<'_>
Convert into a borrowed version
sourcepub fn into_owned(self) -> UntypedRequest<'static>
pub fn into_owned(self) -> UntypedRequest<'static>
Convert into an owned version
sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Allocates a new collection of bytes representing the request.
sourcepub fn from_slice(input: &'a [u8]) -> Result<Self, UntypedRequestParseError>
pub fn from_slice(input: &'a [u8]) -> Result<Self, UntypedRequestParseError>
Parses a collection of bytes, returning a partial request if it can be potentially
represented as a Request depending on the payload, or the original bytes if it does not
represent a Request
NOTE: This supports parsing an invalid request where the payload would not properly deserialize, but the bytes themselves represent a complete request of some kind.
Trait Implementations
sourceimpl<'a> Clone for UntypedRequest<'a>
impl<'a> Clone for UntypedRequest<'a>
sourcefn clone(&self) -> UntypedRequest<'a>
fn clone(&self) -> UntypedRequest<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl<'a> Debug for UntypedRequest<'a>
impl<'a> Debug for UntypedRequest<'a>
sourceimpl<'de, 'a> Deserialize<'de> for UntypedRequest<'a>
impl<'de, 'a> Deserialize<'de> for UntypedRequest<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> Hash for UntypedRequest<'a>
impl<'a> Hash for UntypedRequest<'a>
sourceimpl<'a> PartialEq<UntypedRequest<'a>> for UntypedRequest<'a>
impl<'a> PartialEq<UntypedRequest<'a>> for UntypedRequest<'a>
sourcefn eq(&self, other: &UntypedRequest<'a>) -> bool
fn eq(&self, other: &UntypedRequest<'a>) -> bool
sourceimpl<'a> Serialize for UntypedRequest<'a>
impl<'a> Serialize for UntypedRequest<'a>
impl<'a> Eq for UntypedRequest<'a>
impl<'a> StructuralEq for UntypedRequest<'a>
impl<'a> StructuralPartialEq for UntypedRequest<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for UntypedRequest<'a>
impl<'a> Send for UntypedRequest<'a>
impl<'a> Sync for UntypedRequest<'a>
impl<'a> Unpin for UntypedRequest<'a>
impl<'a> UnwindSafe for UntypedRequest<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more