pub struct AttachedUnit {
inner: RefCell<Box<dyn Unit>>,
unit: Unsigned6Bit,
pub is_input_unit: bool,
pub connected: bool,
pub in_maintenance: bool,
}
Expand description
A unit which is known to the emulator (whether or not it is in “connected” mode).
Fields§
§inner: RefCell<Box<dyn Unit>>
§unit: Unsigned6Bit
§is_input_unit: bool
True for units which are input units. Some devices (Lincoln Writers for example) occupy two units, one for read (input) and the other for write (output).
connected: bool
§in_maintenance: bool
Implementations§
Source§impl AttachedUnit
impl AttachedUnit
fn is_disconnected_output_unit(&self) -> bool
Sourcefn call_inner<A, F, T>(
&self,
what: &str,
alarmer: &mut A,
diagnostics: &CurrentInstructionDiagnostics,
f: F,
) -> Result<T, Alarm>
fn call_inner<A, F, T>( &self, what: &str, alarmer: &mut A, diagnostics: &CurrentInstructionDiagnostics, f: F, ) -> Result<T, Alarm>
Call function f
on a unit, which must already be connected.
If the unit is not connected, calling this method is a bug.
Sourcefn call_mut_inner<A, F, T>(
&self,
what: &str,
alarmer: &mut A,
diagnostics: &CurrentInstructionDiagnostics,
f: F,
) -> Result<T, Alarm>
fn call_mut_inner<A, F, T>( &self, what: &str, alarmer: &mut A, diagnostics: &CurrentInstructionDiagnostics, f: F, ) -> Result<T, Alarm>
Call function f
on a unit, which must already be connected.
If the unit is not connected, calling this method is a bug.
Sourcepub fn poll<A: Alarmer>(
&self,
ctx: &Context,
_alarmer: &mut A,
) -> Result<UnitStatus, Alarm>
pub fn poll<A: Alarmer>( &self, ctx: &Context, _alarmer: &mut A, ) -> Result<UnitStatus, Alarm>
Query the status of an attached (but perhaps not connected) unit.
Sourcefn text_info(&self, ctx: &Context) -> String
fn text_info(&self, ctx: &Context) -> String
Fetch a human-readable description of a unit (which may not be connected).
Sourcepub fn connect(&self, ctx: &Context, mode: Unsigned12Bit)
pub fn connect(&self, ctx: &Context, mode: Unsigned12Bit)
Connect an attached (and perhaps already connected) unit.
Sourcepub fn disconnect<A: Alarmer>(
&self,
ctx: &Context,
_alarmer: &mut A,
) -> Result<(), Alarm>
pub fn disconnect<A: Alarmer>( &self, ctx: &Context, _alarmer: &mut A, ) -> Result<(), Alarm>
Disconnect an attached unit, leaving it attached but not connected.
Sourcepub fn transfer_mode<A: Alarmer>(
&self,
alarmer: &mut A,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<TransferMode, Alarm>
pub fn transfer_mode<A: Alarmer>( &self, alarmer: &mut A, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<TransferMode, Alarm>
Query the TransferMode
of a connected unit.
Sourcepub fn read<A: Alarmer>(
&self,
ctx: &Context,
alarmer: &mut A,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<MaskedWord, TransferFailed>
pub fn read<A: Alarmer>( &self, ctx: &Context, alarmer: &mut A, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<MaskedWord, TransferFailed>
Perform a TSD for a connected input unit.
Sourcepub fn write(
&mut self,
ctx: &Context,
source: Unsigned36Bit,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<Option<OutputEvent>, TransferFailed>
pub fn write( &mut self, ctx: &Context, source: Unsigned36Bit, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<Option<OutputEvent>, TransferFailed>
Perform a TSD for a connected output unit.
Sourcepub fn on_input_event(
&self,
ctx: &Context,
event: InputEvent,
) -> Result<InputFlagRaised, InputEventError>
pub fn on_input_event( &self, ctx: &Context, event: InputEvent, ) -> Result<InputFlagRaised, InputEventError>
Announce an input event for a connected unit.