Enum wasefire_protocol::Api

source ·
#[non_exhaustive]
pub enum Api<'a, T: Direction> { ApiVersion(T::Type<'a, ApiVersion>), AppletRequest(T::Type<'a, AppletRequest>), AppletResponse(T::Type<'a, AppletResponse>), PlatformReboot(T::Type<'a, PlatformReboot>), AppletTunnel(T::Type<'a, AppletTunnel>), PlatformInfo(T::Type<'a, PlatformInfo>), PlatformVendor(T::Type<'a, PlatformVendor>), }
Expand description

Protocol API parametric over the message direction.

Variants gated by the full feature are deprecated. They won’t be used by new devices. However, to support older devices, the host must be able to use them.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ApiVersion(T::Type<'a, ApiVersion>)

Returns the device API version.

§

AppletRequest(T::Type<'a, AppletRequest>)

Sends a request to an applet.

§

AppletResponse(T::Type<'a, AppletResponse>)

Reads a response from an applet.

§

PlatformReboot(T::Type<'a, PlatformReboot>)

Reboots the platform.

§

AppletTunnel(T::Type<'a, AppletTunnel>)

Starts a direct tunnel with an applet.

§

PlatformInfo(T::Type<'a, PlatformInfo>)

Returns platform information (e.g. serial and version).

§

PlatformVendor(T::Type<'a, PlatformVendor>)

Calls a vendor-specific platform command.

Implementations§

source§

impl<'a> Api<'a, Request>

source

pub fn encode(&self) -> Result<Box<[u8]>, Error>

Available on crate feature host only.
source

pub fn decode(data: &'a [u8]) -> Result<Self, Error>

Available on crate feature device only.

Trait Implementations§

source§

impl<'a, T: Debug + Direction> Debug for Api<'a, T>
where T::Type<'a, ApiVersion>: Debug, T::Type<'a, AppletRequest>: Debug, T::Type<'a, AppletResponse>: Debug, T::Type<'a, PlatformReboot>: Debug, T::Type<'a, AppletTunnel>: Debug, T::Type<'a, PlatformInfo>: Debug, T::Type<'a, PlatformVendor>: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, T: Direction> Wire<'a> for Api<'a, T>

§

type Type<'_a> = Api<'_a, T>

source§

fn encode(&self, writer: &mut Writer<'a>) -> Result<()>

source§

fn decode(reader: &mut Reader<'a>) -> Result<Self>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Api<'a, T>
where <T as Direction>::Type<'a, ApiVersion>: Freeze, <T as Direction>::Type<'a, AppletRequest>: Freeze, <T as Direction>::Type<'a, AppletResponse>: Freeze, <T as Direction>::Type<'a, PlatformReboot>: Freeze, <T as Direction>::Type<'a, AppletTunnel>: Freeze, <T as Direction>::Type<'a, PlatformInfo>: Freeze, <T as Direction>::Type<'a, PlatformVendor>: Freeze,

§

impl<'a, T> RefUnwindSafe for Api<'a, T>
where <T as Direction>::Type<'a, ApiVersion>: RefUnwindSafe, <T as Direction>::Type<'a, AppletRequest>: RefUnwindSafe, <T as Direction>::Type<'a, AppletResponse>: RefUnwindSafe, <T as Direction>::Type<'a, PlatformReboot>: RefUnwindSafe, <T as Direction>::Type<'a, AppletTunnel>: RefUnwindSafe, <T as Direction>::Type<'a, PlatformInfo>: RefUnwindSafe, <T as Direction>::Type<'a, PlatformVendor>: RefUnwindSafe,

§

impl<'a, T> Send for Api<'a, T>
where <T as Direction>::Type<'a, ApiVersion>: Send, <T as Direction>::Type<'a, AppletRequest>: Send, <T as Direction>::Type<'a, AppletResponse>: Send, <T as Direction>::Type<'a, PlatformReboot>: Send, <T as Direction>::Type<'a, AppletTunnel>: Send, <T as Direction>::Type<'a, PlatformInfo>: Send, <T as Direction>::Type<'a, PlatformVendor>: Send,

§

impl<'a, T> Sync for Api<'a, T>
where <T as Direction>::Type<'a, ApiVersion>: Sync, <T as Direction>::Type<'a, AppletRequest>: Sync, <T as Direction>::Type<'a, AppletResponse>: Sync, <T as Direction>::Type<'a, PlatformReboot>: Sync, <T as Direction>::Type<'a, AppletTunnel>: Sync, <T as Direction>::Type<'a, PlatformInfo>: Sync, <T as Direction>::Type<'a, PlatformVendor>: Sync,

§

impl<'a, T> Unpin for Api<'a, T>
where <T as Direction>::Type<'a, ApiVersion>: Unpin, <T as Direction>::Type<'a, AppletRequest>: Unpin, <T as Direction>::Type<'a, AppletResponse>: Unpin, <T as Direction>::Type<'a, PlatformReboot>: Unpin, <T as Direction>::Type<'a, AppletTunnel>: Unpin, <T as Direction>::Type<'a, PlatformInfo>: Unpin, <T as Direction>::Type<'a, PlatformVendor>: Unpin,

§

impl<'a, T> UnwindSafe for Api<'a, T>
where <T as Direction>::Type<'a, ApiVersion>: UnwindSafe, <T as Direction>::Type<'a, AppletRequest>: UnwindSafe, <T as Direction>::Type<'a, AppletResponse>: UnwindSafe, <T as Direction>::Type<'a, PlatformReboot>: UnwindSafe, <T as Direction>::Type<'a, AppletTunnel>: UnwindSafe, <T as Direction>::Type<'a, PlatformInfo>: UnwindSafe, <T as Direction>::Type<'a, PlatformVendor>: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<'a, T> Wire<'a> for T
where T: Wire<'a>,