Skip to main content

TimeAxis

Struct TimeAxis 

Source
pub struct TimeAxis {
    pub start: f64,
    pub end: f64,
    pub min: f64,
    pub max: f64,
    pub min_span: f64,
}
Expand description

The shared time window (TIME-1). [start, end] is what’s visible; [min, max] is the hard clamp (the data’s full extent); min_span caps how far you can zoom in.

Fields§

§start: f64

Left edge of the visible window (axis units).

§end: f64

Right edge of the visible window (axis units); always > start.

§min: f64

Hard clamp: the window never pans/zooms outside [min, max].

§max: f64§min_span: f64

Smallest allowed visible span (max zoom-in).

Implementations§

Source§

impl TimeAxis

Source

pub fn new(min: f64, max: f64) -> Self

A window spanning [min, max] fully zoomed out.

Source

pub fn span(&self) -> f64

The visible span (end - start).

Source

pub fn max_span(&self) -> f64

The largest span the clamp allows (the full data extent).

Source

pub fn to_frac(&self, t: f64) -> f64

Map an axis-unit time to a 0.0..=1.0 fraction of the visible window (<0 / >1 = off-screen left/right). The renderer multiplies by pixel width to place a bar/event.

Source

pub fn from_frac(&self, f: f64) -> f64

Inverse of to_frac: the time at window fraction f.

Source

pub fn pan(&mut self, delta: f64)

Pan by a delta in axis units (positive slides later), clamped so the window stays inside [min, max].

Source

pub fn zoom(&mut self, factor: f64, pivot: f64)

Zoom toward a pivot time by factor (>1 narrows / zooms in), keeping the pivot time at the same on-screen fraction — the natural map/plot feel applied to time. Clamps the new span to [min_span, max_span].

Source

pub fn fit(&mut self, start: f64, end: f64)

Snap the window to [start, end] (fit-to-range), clamped to bounds.

Source

pub fn set_bounds(&mut self, min: f64, max: f64)

Widen (or reset) the clamp bounds, then re-clamp the window into them.

Source

pub fn sync_from(&mut self, other: &TimeAxis)

Link to another axis: copy its visible window (a shared scrubber scrolls several facets together, TIME-1). Bounds/min_span stay this axis’s own.

Source

pub fn update(&mut self, msg: TimeMsg) -> Vec<TimeEffect>

The single mutation path (FC-2 / FC-8). Apply one TimeMsg; return a TimeEffect::WindowChanged iff the visible window actually moved (empty otherwise), so linked axes only re-sync on a real change.

Source

pub fn state_json(&self) -> Value

Observable state as JSON (the state_json discipline).

Trait Implementations§

Source§

impl Clone for TimeAxis

Source§

fn clone(&self) -> TimeAxis

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for TimeAxis

Source§

impl Debug for TimeAxis

Source§

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

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

impl Default for TimeAxis

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TimeAxis

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TimeAxis

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for TimeAxis

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TimeAxis

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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, 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.