[−][src]Struct parsec_interface::requests::common::wire_header_1_0::WireHeader
Raw representation of a common request/response header, as defined for the wire format.
Serialisation and deserialisation are handled by serde
, also in tune with the
wire format (i.e. little-endian, native encoding).
Fields
flags: u16
Implementation-defined flags. Not used in Parsec currently. Must be present, but must be zero.
provider: u8
Provider ID value
session: u64
Session handle
content_type: u8
Content type: defines how the request body should be processed.
accept_type: u8
Accept type: defines how the service should provide its response.
auth_type: u8
Authentication type.
body_len: u32
Number of bytes of content.
auth_len: u16
Number of bytes of authentication.
opcode: u32
Opcode of the operation to perform.
status: u16
Response status of the request.
reserved1: u8
Reserved byte. Currently unused. Must be present. Must be zero.
reserved2: u8
Reserved byte. Currently unused. Must be present. Must be zero.
Implementations
impl WireHeader
[src]
pub fn write_to_stream<W: Write>(&self, stream: &mut W) -> Result<()>
[src]
Serialise the request header and write the corresponding bytes to the given stream.
Errors
- if marshalling the header fails,
ResponseStatus::InvalidEncoding
is returned. - if writing the header bytes fails,
ResponseStatus::ConnectionError
is returned.
pub fn read_from_stream<R: Read>(stream: &mut R) -> Result<WireHeader>
[src]
Deserialise a request header from the given stream.
Errors
- if either the magic number or the header size are invalid values,
ResponseStatus::InvalidHeader
is returned. - if reading the fields after magic number and header size fails,
ResponseStatus::ConnectionError
is returned- the read may fail due to a timeout if not enough bytes are sent across
- if the parsed bytes cannot be unmarshalled into the contained fields,
ResponseStatus::InvalidEncoding
is returned. - if the wire protocol version used is different than 1.0
Trait Implementations
impl Clone for WireHeader
[src]
fn clone(&self) -> WireHeader
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for WireHeader
[src]
impl Debug for WireHeader
[src]
impl<'de> Deserialize<'de> for WireHeader
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl From<RequestHeader> for Raw
[src]
Conversion from native to raw request header.
This is required in order to bring the contents of the header in a state which can be serialized.
fn from(header: RequestHeader) -> Self
[src]
impl From<ResponseHeader> for Raw
[src]
Conversion from native to raw response header.
This is required in order to bring the contents of the header in a state which can be serialized.
fn from(header: ResponseHeader) -> Self
[src]
impl Serialize for WireHeader
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl TryFrom<WireHeader> for RequestHeader
[src]
Conversion from the raw to native request header.
This conversion must be done before a Request
value can be populated.
type Error = ResponseStatus
The type returned in the event of a conversion error.
fn try_from(header: Raw) -> Result<Self, Self::Error>
[src]
impl TryFrom<WireHeader> for ResponseHeader
[src]
Conversion from the raw to native response header.
This conversion must be done before a Response
value can be populated.
type Error = ResponseStatus
The type returned in the event of a conversion error.
fn try_from(header: Raw) -> Result<ResponseHeader>
[src]
Auto Trait Implementations
impl RefUnwindSafe for WireHeader
impl Send for WireHeader
impl Sync for WireHeader
impl Unpin for WireHeader
impl UnwindSafe for WireHeader
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,