pub struct FocusList<T> { /* private fields */ }
Expand description
List of items that tracks a current and previous focus.
Implementations§
source§impl<T> FocusList<T>
impl<T> FocusList<T>
sourcepub fn get_mut(&mut self) -> Option<&mut T>
pub fn get_mut(&mut self) -> Option<&mut T>
Get a mutable reference to the currently focused item.
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
Iterate over mutable references to the items in this list.
sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Iterate over references to the items in this list.
sourcepub fn try_close<E, F>(
&mut self,
target: &TabTarget,
f: F,
ctx: &EditContext,
) -> Result<(), E>
pub fn try_close<E, F>( &mut self, target: &TabTarget, f: F, ctx: &EditContext, ) -> Result<(), E>
Try closing targeted items using f
until one fails or all targets are closed.
If the target cannot be closed, focus will be moved to it.
sourcepub fn target(
&self,
change: &FocusChange,
ctx: &EditContext,
) -> Option<(usize, MoveDir1D)>
pub fn target( &self, change: &FocusChange, ctx: &EditContext, ) -> Option<(usize, MoveDir1D)>
Determine the index of the item targeted by a given FocusChange.
The MoveDir1D value returned indicates which side of the index to insert at.
sourcepub fn insert(&mut self, idx: usize, side: MoveDir1D, item: T)
pub fn insert(&mut self, idx: usize, side: MoveDir1D, item: T)
Insert an item before or after a given index.
sourcepub fn remove_current(&mut self)
pub fn remove_current(&mut self)
Remove the currently focused item.
sourcepub fn focus(&mut self, change: &FocusChange, ctx: &EditContext)
pub fn focus(&mut self, change: &FocusChange, ctx: &EditContext)
Switch focus to a new item.
sourcepub fn transfer(&mut self, change: &FocusChange, ctx: &EditContext)
pub fn transfer(&mut self, change: &FocusChange, ctx: &EditContext)
Move the currently focused item to a new position.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for FocusList<T>
impl<T> RefUnwindSafe for FocusList<T>where
T: RefUnwindSafe,
impl<T> Send for FocusList<T>where
T: Send,
impl<T> Sync for FocusList<T>where
T: Sync,
impl<T> Unpin for FocusList<T>where
T: Unpin,
impl<T> UnwindSafe for FocusList<T>where
T: UnwindSafe,
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