Struct distant_net::common::UntypedRequest  
source · pub struct UntypedRequest<'a> {
    pub id: Cow<'a, str>,
    pub payload: Cow<'a, [u8]>,
}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§
source§impl<'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§
source§impl<'a> Clone for UntypedRequest<'a>
 
impl<'a> Clone for UntypedRequest<'a>
source§fn clone(&self) -> UntypedRequest<'a>
 
fn clone(&self) -> UntypedRequest<'a>
Returns a copy 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 moresource§impl<'a> Debug for UntypedRequest<'a>
 
impl<'a> Debug for UntypedRequest<'a>
source§impl<'de, 'a> Deserialize<'de> for UntypedRequest<'a>
 
impl<'de, 'a> Deserialize<'de> for UntypedRequest<'a>
source§fn 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
source§impl<'a> Hash for UntypedRequest<'a>
 
impl<'a> Hash for UntypedRequest<'a>
source§impl<'a> PartialEq<UntypedRequest<'a>> for UntypedRequest<'a>
 
impl<'a> PartialEq<UntypedRequest<'a>> for UntypedRequest<'a>
source§fn eq(&self, other: &UntypedRequest<'a>) -> bool
 
fn eq(&self, other: &UntypedRequest<'a>) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl<'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§
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