pub trait TimestampManipulation:
Timestamp
+ TotalOrder
+ Lattice
+ Debug
+ StepForward
+ Sync {
// Required methods
fn step_forward(&self) -> Self;
fn step_forward_by(&self, amount: &Self) -> Self;
fn try_step_forward_by(&self, amount: &Self) -> Option<Self>;
fn try_step_forward(&self) -> Option<Self>;
fn step_back(&self) -> Option<Self>;
fn maximum() -> Self;
fn round_up(&self, schedule: &RefreshSchedule) -> Option<Self>;
fn round_down_minus_1(&self, schedule: &RefreshSchedule) -> Option<Self>;
}
Required Methods§
Sourcefn step_forward(&self) -> Self
fn step_forward(&self) -> Self
Advance a timestamp by the least amount possible such that
ts.less_than(ts.step_forward())
is true. Panic if unable to do so.
Sourcefn step_forward_by(&self, amount: &Self) -> Self
fn step_forward_by(&self, amount: &Self) -> Self
Advance a timestamp forward by the given amount
. Panic if unable to do so.
Sourcefn try_step_forward_by(&self, amount: &Self) -> Option<Self>
fn try_step_forward_by(&self, amount: &Self) -> Option<Self>
Advance a timestamp forward by the given amount
. Return None
if unable to do so.
Sourcefn try_step_forward(&self) -> Option<Self>
fn try_step_forward(&self) -> Option<Self>
Advance a timestamp by the least amount possible such that ts.less_than(ts.step_forward())
is true. Return None
if unable to do so.
Sourcefn step_back(&self) -> Option<Self>
fn step_back(&self) -> Option<Self>
Retreat a timestamp by the least amount possible such that
ts.step_back().unwrap().less_than(ts)
is true. Return None
if unable,
which must only happen if the timestamp is Timestamp::minimum()
.
Sourcefn round_up(&self, schedule: &RefreshSchedule) -> Option<Self>
fn round_up(&self, schedule: &RefreshSchedule) -> Option<Self>
Rounds up the timestamp to the time of the next refresh according to the given schedule. Returns None if there is no next refresh.
Sourcefn round_down_minus_1(&self, schedule: &RefreshSchedule) -> Option<Self>
fn round_down_minus_1(&self, schedule: &RefreshSchedule) -> Option<Self>
Rounds down timestamp - 1
to the time of the previous refresh according to the given
schedule.
Returns None if there is no previous refresh.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.