#[non_exhaustive]pub struct ControllerCtx {Show 15 fields
pub op_name: String,
pub op_dir: PathBuf,
pub dt_ns: u32,
pub timeout_to_operating_ns: u32,
pub binding_timeout_ms: u16,
pub configuring_timeout_ms: u16,
pub peripheral_loss_of_contact_limit: u16,
pub controller_loss_of_contact_limit: u16,
pub termination_criteria: Option<Termination>,
pub loss_of_contact_policy: LossOfContactPolicy,
pub loop_method: LoopMethod,
pub user_ctx: BTreeMap<String, String>,
pub user_channels: Arc<RwLock<BTreeMap<String, Channel>>>,
pub manual_inputs: ManualInputMap,
pub enable_manual_inputs: bool,
}Expand description
Operation context, provided to appendages during init
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.op_name: StringA name for this controller op, which will be used as the name of the file/table/bucket/etc of each data dispatcher and must be compatible with that use.
op_dir: PathBufA directory to find file inputs and place outputs.
dt_ns: u32Control cycle period in nanoseconds
timeout_to_operating_ns: u32Delay from end of configuration window after which the peripherals time out to the Operating state
binding_timeout_ms: u16Duration to wait for responses to binding
configuring_timeout_ms: u16Duration for peripherals to wait to receive configuration after being bound
peripheral_loss_of_contact_limit: u16Number of consecutive missed control inputs after which the peripheral should assume contact has been lost, de-energize their outputs, and wait to bind a controller again.
controller_loss_of_contact_limit: u16Number of consecutive missed responses from a peripheral after which the controller should assume contact has been lost
termination_criteria: Option<Termination>A condition for exiting the control loop, to be checked at each cycle
loss_of_contact_policy: LossOfContactPolicyResponse to losing contact with a peripheral
loop_method: LoopMethodWhether to prioritize performance or efficiency in the control loop.
user_ctx: BTreeMap<String, String>An escape hatch for sideloading user context (likely json-encoded) that is not yet implemented as a standalone field.
user_channels: Arc<RwLock<BTreeMap<String, Channel>>>An escape hatch for sideloading communication between appendages. Each channel is a bidirectional MPMC message pipe.
Because bidirectional channels may not close until the program terminates on its own, the status of these channels should not be used to indicate when a freerunning thread should terminate, as this will often result in a resource leak.
manual_inputs: ManualInputMapManual input overrides that can be written while the controller is running.
enable_manual_inputs: boolWhether manual input overrides should be applied during the control loop.
Implementations§
Source§impl ControllerCtx
impl ControllerCtx
Sourcepub fn source_endpoint(&self, channel_name: &str) -> Endpoint
pub fn source_endpoint(&self, channel_name: &str) -> Endpoint
Get a handle to a source endpoint tx/rx pair for the channel, creating the channel if it does not exist.
Sourcepub fn sink_endpoint(&self, channel_name: &str) -> Endpoint
pub fn sink_endpoint(&self, channel_name: &str) -> Endpoint
Get a handle to a sink endpoint tx/rx pair for the channel, creating the channel if it does not exist.
Trait Implementations§
Source§impl Clone for ControllerCtx
impl Clone for ControllerCtx
Source§fn clone(&self) -> ControllerCtx
fn clone(&self) -> ControllerCtx
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ControllerCtx
impl Debug for ControllerCtx
Source§impl Default for ControllerCtx
impl Default for ControllerCtx
Source§impl<'de> Deserialize<'de> for ControllerCtx
impl<'de> Deserialize<'de> for ControllerCtx
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ControllerCtx
impl RefUnwindSafe for ControllerCtx
impl Send for ControllerCtx
impl Sync for ControllerCtx
impl Unpin for ControllerCtx
impl UnwindSafe for ControllerCtx
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.