pub struct Ticks<'clock, C: 'clock> {
pub value: u32,
pub clock: &'clock C,
}Expand description
Represents a number of ticks of a given clock
This struct is used to represent an amount of time, a duration, but in a low-level way that hardware peripherals can understand and handle. It is meant to be a common denominator that higher-level time APIs can be built on top of.
Fields§
§value: u32The number of ticks
clock: &'clock CReference to the clock
For many clocks, it’s possible to change their frequency. If this were
to be done after an instance of Ticks had been created, that would
invalidate the Ticks instance, as the same number of ticks would
suddenly represent a different duration of time.
This reference exists to prevent this. Any change to the configuration of a clock would presumably require a mutable reference, which means as long as this shared reference to the clock exists, the compiler will prevent the clock frequency from being changed.