Api

Trait Api 

Source
pub trait Api: Send {
    type Protocol: Api;
    type Update: Api;

    // Required methods
    fn serial() -> Cow<'static, [u8]>;
    fn running_side() -> Side;
    fn running_version() -> Cow<'static, [u8]>;
    fn opposite_version() -> Result<Cow<'static, [u8]>, Error>;
    fn reboot() -> Result<!, Error>;
}
Expand description

Platform interface.

Required Associated Types§

Source

type Protocol: Api

Platform protocol interface.

Source

type Update: Api

Platform update interface.

Calling finish() will reboot if the update is successful and thus only returns in case of errors or in dry-run mode.

Required Methods§

Source

fn serial() -> Cow<'static, [u8]>

Returns the platform serial.

Source

fn running_side() -> Side

Returns the platform running side.

Source

fn running_version() -> Cow<'static, [u8]>

Returns the platform running version.

Versions are comparable with lexicographical order.

Source

fn opposite_version() -> Result<Cow<'static, [u8]>, Error>

Returns the version of the opposite side, if any.

§Errors

There is a precise meaning to the following errors:

  • World:NotEnough: This platform has only one side.
  • World:NotFound: The other side is empty.
Source

fn reboot() -> Result<!, Error>

Reboots the device (thus platform and applets).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§