Skip to main content

Moving

Struct Moving 

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

Everything the view is in the middle of showing.

Implementations§

Source§

impl Moving

Source

pub fn new(now: Instant) -> Self

Nothing moving, as of now.

Source

pub fn tick(&mut self, now: Instant)

Moves the clock on, before anything asks a question whose answer depends on it.

Split out from Moving::advance because the caller has work to do between the two — working out what each row is worth given what is draining away under it, which is a question about this frame’s instant and not the last one’s.

Source

pub fn advance( &mut self, now: Instant, rows: &[(NodeId, u64, bool)], freed: u64, )

Advances every drawn row toward what it is really worth, and forgets the rest.

rows is the viewport’s worth of (row, what it is worth now, is that exact), so a row that scrolled off loses its state and a row that scrolls back on starts at the truth. That is the whole of the cost story: this is O(rows on screen), never O(tree).

Exact means the caller is already interpolating that value itself and the chase must not add a second, slower opinion on top — which is what a row emptying is. Jammed rather than skipped, so that when the drain ends the chase carries on from where the ramp left off instead of from wherever it was standing when the drain began.

Source

pub fn shown(&self, id: NodeId, truth: u64) -> u64

What a row draws, which is the truth once it has caught up with it.

Source

pub fn freed(&self) -> u64

What the session has given back so far.

Source

pub fn arrived(&mut self, id: NodeId, now: Instant)

Notes a directory that has just appeared in the tree.

Source

pub fn freshness(&self, id: NodeId) -> f64

How lit a newly arrived row is: 1.0 the moment it lands, 0.0 once it is old news.

Source

pub fn cascade(&mut self, ancestors: &[NodeId], now: Instant)

Lights a mark running outwards through ancestors, nearest first.

Source

pub fn is_cascading(&self, id: NodeId) -> bool

Whether this row’s rung of the cascade is lit at this instant.

A rung that has not come round yet is not lit either, which is what makes the mark travel rather than all of it flashing at once.

Source

pub fn heats(&mut self, id: NodeId)

Notes that a pricing thread has gone into this claim.

Source

pub fn cools(&mut self, id: NodeId)

Notes that it has come back out, with a price or without one.

Source

pub fn cooled(&mut self)

Forgets every claim that was being priced, for the end of the walk: a pool that has stopped leaves nothing hot behind, and a row shimmering for a thread that no longer exists would be the one moving thing here that says nothing.

Source

pub fn is_hot(&self, id: NodeId) -> bool

Whether a pricing thread is inside this claim right now.

Source

pub fn hot(&self) -> impl Iterator<Item = NodeId> + '_

Every claim currently being priced, so the view can drop the ones that have since gone.

Source

pub fn shimmer(&self, width: usize, epoch: Instant) -> usize

Which cell of a width-wide shimmer is lit.

One phase for the whole screen rather than one per row: the reader is being told how many rows are hot, and rows that pulse together are countable at a glance where rows each doing their own thing are not.

Source

pub fn frees(&mut self, id: NodeId, bytes: u64)

Records how much of a target the deleter says has gone so far.

Taken as the total rather than added to, because that is what the event carries: a report that arrives out of order behind a later one is discarded rather than winding the row backwards, which the pool makes possible and nothing else would catch.

Source

pub fn spends(&mut self, id: NodeId, bytes: u64, now: Instant)

Records that the deleter has finished with a target, and starts its dimmed beat.

Source

pub fn is_freeing(&self, id: NodeId) -> bool

Whether bytes are leaving this target right now.

Source

pub fn is_spent(&self, id: NodeId) -> bool

Whether this row has emptied and is spending its last moment on screen.

Source

pub fn is_leaving(&self, id: NodeId) -> bool

Whether the deleter has touched this row at all — either phase.

The one predicate the batch, the marks and space all read, so “a directory the deleter is part way through is not a directory to delete again” is stated once rather than in the three places that could drift.

Source

pub fn leaving(&self) -> impl Iterator<Item = (NodeId, u64)> + '_

Every row the running removal is still on screen for, with the bytes it has given back so far.

What every ancestor subtracts, and half of what the freed counter adds up. Spent targets are in here too until their row collapses, because their bytes are just as gone and the rows above them have to say so.

Source

pub fn freed_from(&self, id: NodeId) -> u64

What the deleter has given back from this row so far.

Source

pub fn freed_so_far(&self) -> u64

What the running batch has given back in total, rows still on screen and rows already collapsed alike.

Source

pub fn collapsed(&mut self, now: Instant) -> Vec<NodeId>

The rows whose dimmed beat is over, which the view then takes out of the tree for real. Forgotten here in the same breath, so each is handed over exactly once.

Source

pub fn banked(&mut self)

Hands the running total over to the caller’s own, when the batch has reported one.

The per-target figures and the crate::delete::Removal are the same arithmetic from the same accounting, so keeping both would count every byte twice. The dimmed rows stay where they are: what they are worth on screen is zero either way, and it is the tree that still has to lose them.

Everything dropped here is transient, which is a constraint on the caller as much as a description. A target the sweep finished with is on its way out of the tree anyway; a target it could not finish is staying, and the only record that it is smaller than it was is the figure about to be cleared. So an incomplete target’s reduction has to be made durable before this runs, or its row and every total above it spring back to what they were worth before the deletion — see super::state::View::deleted, which is the one caller, and crate::tree::Tree::shrink, which is where the bytes go.

Source

pub fn is_moving(&self) -> bool

Whether anything at all is still in motion.

What the event loop reads to decide how often to repaint: a view with something moving in it earns a smooth frame rate, and a view a reader is sitting and thinking in front of does not.

Trait Implementations§

Source§

impl Debug for Moving

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.