pub struct TickRate { /* private fields */ }Expand description
How many ticks a counter advances in a second: what turns Tickdelta into a
Timedelta and back.
A conversion is a multiply and a shift, with factors from_hertz works out
once: no division. An exact multiple converts exactly, any other count to within one unit of
its exact quotient, and the range’s ends saturate. It is written as its hertz, 24000000 Hz,
and parses back from it.
§Examples
use t2t_core::{TickRate, Tickdelta, Timedelta};
let rate: TickRate = "24000000 Hz".parse()?;
assert_eq!(Tickdelta::from_ticks(24).to_timedelta(rate), Timedelta::MICROSECOND, "at 24 MHz");
assert_eq!(Timedelta::SECOND.to_tickdelta(rate), Tickdelta::from_ticks(24_000_000), "and back");Implementations§
Trait Implementations§
impl Copy for TickRate
Source§impl<'de> Deserialize<'de> for TickRate
impl<'de> Deserialize<'de> for TickRate
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TickRate
impl Immutable for TickRatewhere
NonZeroU64: Immutable,
Scale: Immutable,
Source§impl JsonSchema for TickRate
impl JsonSchema for TickRate
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl KnownLayout for TickRatewhere
Self: Sized,
impl KnownLayout for TickRatewhere
Self: Sized,
Source§type PointerMetadata = ()
type PointerMetadata = ()
The type of metadata stored in a pointer to
Self. Read more§fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Computes the size of an object of type
Self with the given pointer
metadata. Read moreSource§impl Ord for TickRate
impl Ord for TickRate
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for TickRate
impl PartialOrd for TickRate
impl StructuralPartialEq for TickRate
Auto Trait Implementations§
impl Freeze for TickRate
impl RefUnwindSafe for TickRate
impl Send for TickRate
impl Sync for TickRate
impl Unpin for TickRate
impl UnsafeUnpin for TickRate
impl UnwindSafe for TickRate
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
Mutably borrows from an owned value. Read more