Skip to main content

SeriesHandle

Struct SeriesHandle 

Source
pub struct SeriesHandle { /* private fields */ }
Expand description

App-owned, versioned series data. Create once, clone into the spec each frame (a cheap Arc bump), mutate with set / append. The stable id keys the GPU buffer cache for the geometry this series lowers to; revision advances on every mutation so the backend re-uploads only when the data actually changed.

Implementations§

Source§

impl SeriesHandle

Source

pub fn new(samples: impl Into<Vec<Sample>>) -> Self

A handle owning samples, with a fresh stable id.

Source

pub fn empty() -> Self

An empty handle.

Source

pub fn set(&self, samples: impl Into<Vec<Sample>>)

Replace the samples and advance the revision. The hot path for a virtual app: as the user pans/zooms, resample the source to the visible window and set the result.

Source

pub fn append(&self, more: &[Sample])

Append samples to the tail and advance the revision — for a live series that grows over time. Recomputes bounds over the new tail only.

Source

pub fn id(&self) -> GeometryId

The stable id, constant for the handle’s life. Backends key the GPU buffers for this series’ lowered geometry on it.

Source

pub fn revision(&self) -> u64

The current revision; advances on every mutation.

Source

pub fn bounds(&self) -> SeriesBounds

The cached data-space SeriesBounds.

Source

pub fn len(&self) -> usize

The number of samples currently held.

Source

pub fn is_empty(&self) -> bool

Whether the series currently holds no samples.

Source

pub fn snapshot(&self) -> (Arc<Vec<Sample>>, u64)

A snapshot of the samples (a cheap Arc clone) plus the revision it was taken at — what the lowering and backend read.

Trait Implementations§

Source§

impl Clone for SeriesHandle

Source§

fn clone(&self) -> SeriesHandle

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 Debug for SeriesHandle

Source§

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

Formats the value using the given formatter. Read more

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<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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.