Skip to main content

Move

Struct Move 

Source
pub struct Move<K: 'static> { /* private fields */ }
Expand description

A native hierarchical tree (docs/tree.md): rows nest, disclose, and drag to a new parent. The platform widget owns scrolling, disclosure and cell reuse; Day builds each visible row once and rebinds it as cells recycle (list()’s contract, token-addressed). Gate its UI on Cap::Tree: a backend without tree support renders nothing. Drag-to-move for a tree (docs/tree.md): the handler that applies a committed re-parent, an optional guard consulted while the drag is live, and whether the gesture is offered right now. A tree is movable exactly when it carries one of these (tree(..).movable(Move::new(f))). The list() counterpart is Reorder.

Implementations§

Source§

impl<K: 'static> Move<K>

Source

pub fn new(moved: impl Fn(K, Option<K>, Option<usize>) + 'static) -> Move<K>

moved(key, parent, index) runs after a committed move: key now sits under parent (None = the root) at index (None = dropped onto the parent: append). Apply the same re-parent to the backing data; its refresh reloads the tree. Runs at the next event drain, never inside the native drop callback.

Source

pub fn guard( self, g: impl Fn(&K, Option<&K>, Option<usize>) -> MoveVerdict + 'static, ) -> Move<K>

Veto drops while the drag is live. The structural refusals (a row into itself, into its own descendant, into a leaf) are built in; this guard adds the app’s own. Keep it pure: it runs inside the platform’s drag callback.

Source

pub fn enabled<M>(self, on: impl IntoReactive<bool, M>) -> Move<K>

Whether the gesture is offered right now (default true): a constant or a reactive bool, read when the platform asks whether a drag may begin.

Auto Trait Implementations§

§

impl<K> !RefUnwindSafe for Move<K>

§

impl<K> !Send for Move<K>

§

impl<K> !Sync for Move<K>

§

impl<K> !UnwindSafe for Move<K>

§

impl<K> Freeze for Move<K>

§

impl<K> Unpin for Move<K>

§

impl<K> UnsafeUnpin for Move<K>

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
§

impl<T> ErasedDestructor for T
where T: 'static,

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, 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.
Day API ↩ Guides· daybrite.dev