pub struct Context<'a> {
    pub device: &'a mut dyn Device,
    pub errors: &'a mut dyn ErrorQueue,
    pub esr: u8,
    pub ese: u8,
    pub sre: u8,
    pub operation: EventRegister,
    pub questionable: EventRegister,
    /* private fields */
}
Expand description

Context in which to execute a message.

Contains registers related to the context and reference to the writer to respond with. Also contains a reference to the Device (may be shared by multiple contexts (Note! If threadsafe)).

Fields

device: &'a mut dyn Device

Device executed upon

errors: &'a mut dyn ErrorQueue

Error queue

esr: u8

Event Status Register

ese: u8

Event Status Enable register

sre: u8

Service Request Enable register

operation: EventRegister

OPERation:ENABle register

questionable: EventRegister

QUEStionable:ENABle register

Implementations

Create a new context

Arguments
  • device - Device to act upon
  • writer - Writer used to write back response messages
  • root - SCPI command tree to use

Put an error into the queue and set corresponding ESR bits

Executes one SCPI message and queue any errors.

Arguments
  • s - Message to execute
  • response - A Formatter used to write a response
Returns
  • Ok(()) - If message (and all units within) was executed successfully
  • Err(error) - If parser detected or a command returned an error

Executes one SCPI message (terminated by \n) and queue any errors.

Arguments
  • tokenizer - A tokenizer created from Tokenizer::from_str(...). May be re-used if still has valid tokens and Ok() was returned.
Returns
  • Ok(()) - If message (and all units within) was executed successfully
  • Err(error) - If parser detected or a command returned an error

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.