pub struct DeviceManager {
devices: BTreeMap<Unsigned6Bit, AttachedUnit>,
poll_queue: PollQueue,
changes: ChangeIndex<Unsigned6Bit>,
}
Expand description
Manages a collection of devices. Does not actually correspond to a tangible physical component of the TX-2 system.
Fields§
§devices: BTreeMap<Unsigned6Bit, AttachedUnit>
§poll_queue: PollQueue
§changes: ChangeIndex<Unsigned6Bit>
Implementations§
Source§impl DeviceManager
impl DeviceManager
pub fn new() -> DeviceManager
pub fn get(&self, unit_number: &Unsigned6Bit) -> Option<&AttachedUnit>
pub fn get_mut( &mut self, unit_number: &Unsigned6Bit, ) -> Option<&mut AttachedUnit>
pub fn update_poll_time(&mut self, ctx: &Context, seq: SequenceNumber)
fn get_extended_status<A: Alarmer>( &self, ctx: &Context, unit: &AttachedUnit, alarmer: &mut A, index_value: Signed18Bit, ) -> Result<ExtendedUnitState, Alarm>
pub fn device_statuses( &self, ctx: &Context, control: &mut ControlUnit, ) -> Result<BTreeMap<Unsigned6Bit, ExtendedUnitState>, Alarm>
pub fn attach( &mut self, ctx: &Context, unit_type: UnitType, in_maintenance: bool, unit: Box<dyn Unit>, )
pub fn on_input_event( &mut self, ctx: &Context, unit_number: Unsigned6Bit, input_event: InputEvent, ) -> Result<InputFlagRaised, InputEventError>
Sourcepub fn report(
&mut self,
ctx: &Context,
current_sequence: Option<SequenceNumber>,
unit: Unsigned6Bit,
current_flag: bool,
alarm_unit: &mut AlarmUnit,
diagnostics: &CurrentInstructionDiagnostics,
) -> Result<Unsigned36Bit, Alarm>
pub fn report( &mut self, ctx: &Context, current_sequence: Option<SequenceNumber>, unit: Unsigned6Bit, current_flag: bool, alarm_unit: &mut AlarmUnit, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<Unsigned36Bit, Alarm>
Generate a report word for a unit.
pub(crate) fn poll( &mut self, ctx: &Context, alarm_unit: &mut AlarmUnit, ) -> Result<(u64, Option<Alarm>, Option<Duration>), Alarm>
pub fn disconnect_all<A: Alarmer>( &mut self, ctx: &Context, alarmer: &mut A, ) -> Result<(), Alarm>
pub fn disconnect( &mut self, ctx: &Context, device: &Unsigned6Bit, alarm_unit: &mut AlarmUnit, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<(), Alarm>
pub fn connect( &mut self, ctx: &Context, calling_sequence: Option<SequenceNumber>, device: &Unsigned6Bit, mode: Unsigned12Bit, alarm_unit: &mut AlarmUnit, diagnostics: &CurrentInstructionDiagnostics, ) -> Result<Option<FlagChange>, Alarm>
pub fn mark_device_changed(&mut self, unit: Unsigned6Bit)
pub fn drain_changes( &mut self, ctx: &Context, control: &mut ControlUnit, ) -> Result<BTreeMap<Unsigned6Bit, ExtendedUnitState>, Alarm>
Trait Implementations§
Source§impl Debug for DeviceManager
impl Debug for DeviceManager
Source§impl Default for DeviceManager
impl Default for DeviceManager
Source§fn default() -> DeviceManager
fn default() -> DeviceManager
We’re implementing this mainly to keep clippy happy.
Auto Trait Implementations§
impl Freeze for DeviceManager
impl !RefUnwindSafe for DeviceManager
impl !Send for DeviceManager
impl !Sync for DeviceManager
impl Unpin for DeviceManager
impl !UnwindSafe for DeviceManager
Blanket Implementations§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<Src> TryFrom<Src> for Src
impl<Src> TryFrom<Src> for Src
§impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
§impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
§fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.
§impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
§fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.