pub struct DragDropResponse {
    pub update: Option<DragUpdate>,
    /* private fields */
}
Expand description

Response containing state of the drag & drop list and a potential update to the source list. The update can be applied immediately or at latest when DragDropResponse::is_drag_finished returns true.

Fields§

§update: Option<DragUpdate>

Contains ongoing information about which index is currently being dragged where. You can use this to consistently update the source list while the drag & drop event is ongoing. If you only want to update the source list when the drag & drop event has finished, use DragDropResponse::final_update instead.

Implementations§

source§

impl DragDropResponse

source

pub fn is_evaluating_drag(&self) -> bool

Returns true if we are currently evaluating whether a drag should be started.

source

pub fn is_dragging(&self) -> bool

Returns true if we are currently dragging an item.

source

pub fn dragged_item_id(&self) -> Option<Id>

Returns the id of the item that is currently being dragged.

source

pub fn is_drag_finished(&self) -> bool

Returns true if the drag & drop event has finished and the item has been dropped. The update should be applied to the source list.

source

pub fn update_vec<T>(&self, vec: &mut [T])

Utility function to update a Vec with the current drag & drop state. You can use this to consistently update the source list while the drag & drop event is ongoing.

source

pub fn final_update(&self) -> Option<DragUpdate>

Returns the update if the drag & drop event has finished and the item has been dropped. Useful for the if let syntax.

source

pub fn cancellation_reason(&self) -> Option<&'static str>

Returns a Option<&str> with the reason if a drag & drop event was cancelled.

Trait Implementations§

source§

impl Clone for DragDropResponse

source§

fn clone(&self) -> DragDropResponse

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DragDropResponse

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.
source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,