pub struct ActivePlusAdjacent { /* private fields */ }Expand description
Tick the active screen’s declared neighbors at full rate while all other inactive screens use a reduced divisor.
Use when navigation between adjacent screens is common (e.g. tab bars) and you want instant-feeling switches without a learned model.
Implementations§
Source§impl ActivePlusAdjacent
impl ActivePlusAdjacent
Sourcepub fn new(background_divisor: u64) -> Self
pub fn new(background_divisor: u64) -> Self
Create an empty adjacency strategy with the given background divisor.
A divisor of 0 is clamped to 1.
Sourcepub fn add_adjacency(&mut self, screen: &str, neighbors: &[&str])
pub fn add_adjacency(&mut self, screen: &str, neighbors: &[&str])
Declare that screen is adjacent to the given neighbors.
Sourcepub fn from_tab_order(screens: &[&str], background_divisor: u64) -> Self
pub fn from_tab_order(screens: &[&str], background_divisor: u64) -> Self
Build adjacency from a linear tab order.
Each screen becomes adjacent to its immediate left and right neighbors (edges only have one neighbor).
from_tab_order(["A", "B", "C"], 10)
// A <-> B, B <-> CSourcepub const fn background_divisor(&self) -> u64
pub const fn background_divisor(&self) -> u64
Return the background divisor.
Trait Implementations§
Source§impl Clone for ActivePlusAdjacent
impl Clone for ActivePlusAdjacent
Source§fn clone(&self) -> ActivePlusAdjacent
fn clone(&self) -> ActivePlusAdjacent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActivePlusAdjacent
impl Debug for ActivePlusAdjacent
Source§impl TickStrategy for ActivePlusAdjacent
impl TickStrategy for ActivePlusAdjacent
Source§fn should_tick(
&mut self,
screen_id: &str,
tick_count: u64,
active_screen: &str,
) -> TickDecision
fn should_tick( &mut self, screen_id: &str, tick_count: u64, active_screen: &str, ) -> TickDecision
Decide whether to tick an inactive screen on this frame.
Source§fn on_screen_transition(&mut self, _from: &str, _to: &str)
fn on_screen_transition(&mut self, _from: &str, _to: &str)
Called when the runtime observes a screen transition.
Source§fn maintenance_tick(&mut self, _tick_count: u64)
fn maintenance_tick(&mut self, _tick_count: u64)
Called periodically for maintenance work.
Auto Trait Implementations§
impl Freeze for ActivePlusAdjacent
impl RefUnwindSafe for ActivePlusAdjacent
impl Send for ActivePlusAdjacent
impl Sync for ActivePlusAdjacent
impl Unpin for ActivePlusAdjacent
impl UnsafeUnpin for ActivePlusAdjacent
impl UnwindSafe for ActivePlusAdjacent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more