Skip to main content

Reply

Struct Reply 

Source
pub struct Reply {
    pub id: String,
    pub rc: i32,
    pub err: Option<DeviceErr>,
    /* private fields */
}
Expand description

A device’s answer. #[must_use] because rc != 0 is returned, never raised: a dropped Reply is a device error nobody looked at.

Fields§

§id: String

The request id this answers. Already checked against the request that was sent, so a late reply from a timed-out command can never arrive here as this command’s answer.

§rc: i32

A platform errno, INFORMATIVE ONLY — the same “unknown command” is -38 on Linux and -88 on this target, which is exactly why err is the contract (kdi/contract.yaml:23-23).

§err: Option<DeviceErr>

None on success — and also for a token this build does not know, which is legal from a device on a newer minor and must never be a parse failure. ok() still reports false, because it tests rc.

Implementations§

Source§

impl Reply

Source

pub fn ok(&self) -> bool

Did the device accept the command? Tests rc, so it is false for a refusal whose err token this build does not recognise.

Source

pub fn get(&self, k: &str) -> Option<&Value>

One key of the reply body, untyped. The typed Commands methods are what a caller normally wants; this is for a command on a newer minor that has no generated method yet.

Source

pub fn body(&self) -> &str

The reply object as it arrived, for a log or an archive.

Trait Implementations§

Source§

impl Clone for Reply

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Reply

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Reply

§

impl RefUnwindSafe for Reply

§

impl Send for Reply

§

impl Sync for Reply

§

impl Unpin for Reply

§

impl UnsafeUnpin for Reply

§

impl UnwindSafe for Reply

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.