pub struct DiscreteTime { /* private fields */ }Expand description
A time model representing discrete, uniformly spaced ticks instead of continuous physical time.
DiscreteTime is designed for systems that evolve in fixed increments, such as:
- Simulation steps
- Control loops
- State machines
- Reinforcement learning environments
- Event-driven or digital logic systems
This model is ideal when:
- You don’t need wall-clock time or sub-second resolution
- You care only about the order and progression of steps
- Time is measured in counted ticks or iterations
§Fields
id: Unique numeric identifier for the time pointtick_scale: Scale of the tick (e.g.,Milliseconds,Microseconds,Seconds)tick_unit: The current tick index (u64), typically monotonically increasing
§Examples
use deep_causality::{DiscreteTime, Temporal, TimeScale};
let t0 = DiscreteTime::new(1, TimeScale::Microseconds, 0);
let t1 = DiscreteTime::new(2, TimeScale::Microseconds, 1);
assert!(t0.time_unit() < t1.time_unit());
assert_eq!(t0.time_scale(), TimeScale::Microseconds);§Trait Compatibility
- Implements
Identifiableviaid - Implements
Temporal<u64>, so it can be used in any time-aware causal context
§Use Cases
- Agent-based simulations with fixed timesteps
- Ticking state machines (e.g., embedded control)
- Digital logic simulation
- Environments where temporal resolution is implicit or constant
§Note
While tick_unit is a u64 and ordered, it does not imply any physical duration
unless paired with a meaningful TimeScale. The interpretation of ticks is context-dependent.
§See also
SymbolicTimefor non-numeric symbolic eventsLorentzianTimeorProperTimefor physical time
Implementations§
Trait Implementations§
Source§impl Adjustable<u64> for DiscreteTime
impl Adjustable<u64> for DiscreteTime
Source§fn update<const W: usize, const H: usize, const D: usize, const C: usize>(
&mut self,
array_grid: &ArrayGrid<u64, W, H, D, C>,
) -> Result<(), UpdateError>
fn update<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<u64, W, H, D, C>, ) -> Result<(), UpdateError>
The default implementation does nothing to keep update optional.
Override this method to implement a node update when needed.
For a sample implementation, see src/types/context_types/node_types_adjustable
Source§fn adjust<const W: usize, const H: usize, const D: usize, const C: usize>(
&mut self,
array_grid: &ArrayGrid<u64, W, H, D, C>,
) -> Result<(), AdjustmentError>
fn adjust<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<u64, W, H, D, C>, ) -> Result<(), AdjustmentError>
The default implementation does nothing to keep adjustment optional.
Override this method to implement a node adjustment when needed.
Depending on the type of node adjustment, select a 1, 2,3, or 4 dimensional array grid
that contains the transformation data to apply to the node.
For a sample implementation, see src/types/context_types/node_types_adjustable
Source§impl Clone for DiscreteTime
impl Clone for DiscreteTime
Source§fn clone(&self) -> DiscreteTime
fn clone(&self) -> DiscreteTime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiscreteTime
impl Debug for DiscreteTime
Source§impl Display for DiscreteTime
impl Display for DiscreteTime
Source§impl From<DiscreteTime> for TimeKind
impl From<DiscreteTime> for TimeKind
Source§fn from(t: DiscreteTime) -> Self
fn from(t: DiscreteTime) -> Self
Converts to this type from the input type.
Source§impl Hash for DiscreteTime
impl Hash for DiscreteTime
Source§impl Identifiable for DiscreteTime
impl Identifiable for DiscreteTime
Source§impl PartialEq for DiscreteTime
impl PartialEq for DiscreteTime
Source§impl ScalarProjector for DiscreteTime
impl ScalarProjector for DiscreteTime
Source§impl Temporal<u64> for DiscreteTime
impl Temporal<u64> for DiscreteTime
impl Copy for DiscreteTime
impl Eq for DiscreteTime
impl StructuralPartialEq for DiscreteTime
Auto Trait Implementations§
impl Freeze for DiscreteTime
impl RefUnwindSafe for DiscreteTime
impl Send for DiscreteTime
impl Sync for DiscreteTime
impl Unpin for DiscreteTime
impl UnwindSafe for DiscreteTime
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