pub trait Unit {
// Required methods
fn poll(&mut self, ctx: &Context) -> UnitStatus;
fn text_info(&self, ctx: &Context) -> String;
fn connect(&mut self, ctx: &Context, mode: Unsigned12Bit);
fn disconnect(&mut self, ctx: &Context);
fn transfer_mode(&self) -> TransferMode;
fn read(
&mut self,
ctx: &Context,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<MaskedWord, TransferFailed>;
fn write(
&mut self,
ctx: &Context,
source: Unsigned36Bit,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<Option<OutputEvent>, TransferFailed>;
fn name(&self) -> String;
fn on_input_event(
&mut self,
ctx: &Context,
event: InputEvent,
) -> Result<InputFlagRaised, InputEventError>;
}
Required Methods§
Sourcefn poll(&mut self, ctx: &Context) -> UnitStatus
fn poll(&mut self, ctx: &Context) -> UnitStatus
Query the status of the unit.
Sourcefn text_info(&self, ctx: &Context) -> String
fn text_info(&self, ctx: &Context) -> String
Provide a text summary of the state of the device.
Sourcefn disconnect(&mut self, ctx: &Context)
fn disconnect(&mut self, ctx: &Context)
Disconnect the unit.
Sourcefn transfer_mode(&self) -> TransferMode
fn transfer_mode(&self) -> TransferMode
Query the TransferMode
of the unit.
Sourcefn read(
&mut self,
ctx: &Context,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<MaskedWord, TransferFailed>
fn read( &mut self, ctx: &Context, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<MaskedWord, TransferFailed>
Handle a TSD on an input channel.
Sourcefn write(
&mut self,
ctx: &Context,
source: Unsigned36Bit,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<Option<OutputEvent>, TransferFailed>
fn write( &mut self, ctx: &Context, source: Unsigned36Bit, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<Option<OutputEvent>, TransferFailed>
Handle a TSD on an output channel.
Sourcefn on_input_event(
&mut self,
ctx: &Context,
event: InputEvent,
) -> Result<InputFlagRaised, InputEventError>
fn on_input_event( &mut self, ctx: &Context, event: InputEvent, ) -> Result<InputFlagRaised, InputEventError>
Announce an input event for a unit.