pub struct ArkToHost {
pub id: u64,
pub err: Option<Error>,
pub content: Option<Content>,
}Expand description
ArkToHost represents a message sent from the Ark to the host via the USB connection. It embeds all possible message types to keep the protocol simple.
Every message carries an id and is either a request, its id chosen by the Ark, or the Ark’s response to a request of the host, echoing the host’s id. To avoid id collisions, hosts allocate odd ids and Arks even ones, so a receiver can tell a response from a request by the parity of the id alone.
Fields§
§id: u64Enveloping fields, reserved range 0x001-0x0ff
Request identifier, responded to or the Ark’s own
err: Option<Error>Error encountered while serving the host’s request (if any)
content: Option<Content>Body of the message, a response of the Ark to a request of the host or a request of its own. The tags are grouped by area, each area with its own range.
Trait Implementations§
Source§impl Message for ArkToHost
impl Message for ArkToHost
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.