DiscreteTime

Struct DiscreteTime 

Source
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 point
  • tick_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 Identifiable via id
  • 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

  • SymbolicTime for non-numeric symbolic events
  • LorentzianTime or ProperTime for physical time

Implementations§

Source§

impl DiscreteTime

Source

pub fn new(id: u64, tick_scale: TimeScale, tick_unit: u64) -> Self

Trait Implementations§

Source§

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>

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>

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

Source§

fn clone(&self) -> DiscreteTime

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiscreteTime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DiscreteTime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<DiscreteTime> for TimeKind

Source§

fn from(t: DiscreteTime) -> Self

Converts to this type from the input type.
Source§

impl Hash for DiscreteTime

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Identifiable for DiscreteTime

Source§

fn id(&self) -> u64

Source§

impl PartialEq for DiscreteTime

Source§

fn eq(&self, other: &DiscreteTime) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ScalarProjector for DiscreteTime

Source§

type Scalar = u64

The scalar value extracted from the input (must implement ScalarValue)
Source§

fn project(&self) -> Self::Scalar

Extracts a scalar from self.
Source§

impl Temporal<u64> for DiscreteTime

Source§

fn time_scale(&self) -> TimeScale

Returns the unit scale of time (e.g. TimeScale::Milliseconds).
Source§

fn time_unit(&self) -> u64

Returns a reference to the numeric time unit (e.g. 0, 100, 32768).
Source§

impl Copy for DiscreteTime

Source§

impl Eq for DiscreteTime

Source§

impl StructuralPartialEq for DiscreteTime

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Satisfies<NoConstraint> for T