Skip to main content

FocusController

Struct FocusController 

Source
pub struct FocusController {
    pub focus: NodeId,
    pub history: Vec<NodeId>,
    pub candidates: Vec<Candidate>,
    pub selection: usize,
    /* private fields */
}

Fields§

§focus: NodeId§history: Vec<NodeId>§candidates: Vec<Candidate>§selection: usize

Implementations§

Source§

impl FocusController

Source

pub fn new(focus: NodeId, provider: &dyn DataProvider, limit: usize) -> Self

Source

pub fn focus_on(&mut self, id: NodeId, provider: &dyn DataProvider)

Source

pub fn is_pending(&self) -> bool

Whether the candidate list is currently just a pending placeholder — the neighborhood was requested but hadn’t arrived when it was last fetched.

Source

pub fn refetch(&mut self, provider: &dyn DataProvider)

Re-run the fetch for the current focus without disturbing focus/history. Called after an async cache fill resolves a neighborhood that was pending when this controller first fetched it; the provider now returns real data.

Source

pub fn select(&mut self, delta: i32)

Source

pub fn select_index(&mut self, i: usize) -> bool

Move the selection to candidate i. Returns false — changing nothing — when i is out of range or the candidate is a Loading placeholder (inert by design, same as hit-testing). The id→index resolution lives in graph-explorer-wasm, which mints the scene ids; this method is deliberately just the bounds-checked cursor move.

Source

pub fn candidates(&self) -> &[Candidate]

Read-only view for hosts that resolve ids/indices — graph-explorer-wasm’s select_id.

Source

pub fn descend(&mut self, provider: &dyn DataProvider) -> DescendOutcome

Source

pub fn selected(&self) -> Option<SelectionInfo>

What is selected right now, or None when there are no candidates.

Source

pub fn back(&mut self, provider: &dyn DataProvider)

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