pub trait Controller {
type Clock: Clock<TAI>;
type Link<ControllerRef: AsRef<Self>>: Link<Error = Self::Error>;
type Error: Debug;
type ClockConfig: Default;
type LinkConfig: Default;
type TrackedLinkConfig: Default;
// Required methods
fn add_clock(
&self,
clock: Self::Clock,
config: Self::ClockConfig,
) -> Result<ClockId, Self::Error>;
fn remove_clock(&self, clock_id: ClockId) -> Result<(), Self::Error>;
fn create_tracked_link<ControllerRef: AsRef<Self>>(
this: ControllerRef,
clock_a: ClockId,
clock_b: Option<ClockId>,
config: Self::LinkConfig,
tracked_config: Self::TrackedLinkConfig,
) -> Result<Self::Link<ControllerRef>, Self::Error>;
fn create_untracked_link<ControllerRef: AsRef<Self>>(
this: ControllerRef,
clock_a: ClockId,
clock_b: Option<ClockId>,
config: Self::LinkConfig,
) -> Result<Self::Link<ControllerRef>, Self::Error>;
fn clock_snapshot(
&self,
clock: ClockId,
) -> Result<TimeSnapshot, Self::Error>;
fn run<Fut: Future<Output = ()> + Send, F: Send + Fn(Duration) -> Fut>(
this: impl AsRef<Self> + Send,
sleep: F,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}Expand description
A controller for clocks in a system.
Required Associated Types§
Sourcetype Link<ControllerRef: AsRef<Self>>: Link<Error = Self::Error>
type Link<ControllerRef: AsRef<Self>>: Link<Error = Self::Error>
Measurement links between clocks belonging to the controller.
Sourcetype ClockConfig: Default
type ClockConfig: Default
Configuration for internal clocks
Sourcetype LinkConfig: Default
type LinkConfig: Default
Configuration for links
Sourcetype TrackedLinkConfig: Default
type TrackedLinkConfig: Default
Configuration for tracked links (links on which delay is automatically estimated)
Required Methods§
Sourcefn add_clock(
&self,
clock: Self::Clock,
config: Self::ClockConfig,
) -> Result<ClockId, Self::Error>
fn add_clock( &self, clock: Self::Clock, config: Self::ClockConfig, ) -> Result<ClockId, Self::Error>
Add an internal, steered clock to the controller.
§Errors
May error if the controller is unable to handle more internal clocks
Sourcefn remove_clock(&self, clock_id: ClockId) -> Result<(), Self::Error>
fn remove_clock(&self, clock_id: ClockId) -> Result<(), Self::Error>
Remove an internal, steered clock from the controller
§Errors
May error if the internal clock in question is not known to the controller.
Sourcefn create_tracked_link<ControllerRef: AsRef<Self>>(
this: ControllerRef,
clock_a: ClockId,
clock_b: Option<ClockId>,
config: Self::LinkConfig,
tracked_config: Self::TrackedLinkConfig,
) -> Result<Self::Link<ControllerRef>, Self::Error>
fn create_tracked_link<ControllerRef: AsRef<Self>>( this: ControllerRef, clock_a: ClockId, clock_b: Option<ClockId>, config: Self::LinkConfig, tracked_config: Self::TrackedLinkConfig, ) -> Result<Self::Link<ControllerRef>, Self::Error>
Create a measurement link between clocks where the delay and noise from the link itself are automatically determined.
The resulting link may need measurement in both directions to succesfully work
This is an assocatiated function to allow links to store references to the controller in a manner most convenient for the user.
§Errors
May fail if clocks are unknown to the controller, or when both clocks are external clocks.
Sourcefn create_untracked_link<ControllerRef: AsRef<Self>>(
this: ControllerRef,
clock_a: ClockId,
clock_b: Option<ClockId>,
config: Self::LinkConfig,
) -> Result<Self::Link<ControllerRef>, Self::Error>
fn create_untracked_link<ControllerRef: AsRef<Self>>( this: ControllerRef, clock_a: ClockId, clock_b: Option<ClockId>, config: Self::LinkConfig, ) -> Result<Self::Link<ControllerRef>, Self::Error>
Create a measurement link between clocks without delay estimation.
This is an associated function instead of a method to allow links to store references to the controller in a manner most convenient for the user.
§Errors
May fail if clocks are unknown to the controller, or when both clocks are external clocks.
Sourcefn clock_snapshot(&self, clock: ClockId) -> Result<TimeSnapshot, Self::Error>
fn clock_snapshot(&self, clock: ClockId) -> Result<TimeSnapshot, Self::Error>
Get a time snapshot of the synchronization status of a clock.
§Errors
May fail if the clock is unknown to the controller.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".