DropEvent

Struct DropEvent 

Source
pub struct DropEvent<Id>
where Id: Hash + Eq + Clone,
{ pub source: Id, pub target: Id, pub position: DropPosition, }
Expand description

Details of a drag-and-drop event in the outliner.

This struct contains information about a completed drop operation, including the source node that was dragged, the target node it was dropped onto, and the position relative to the target.

§Generic Parameters

  • Id - The type used to identify nodes in the outliner. Must implement Hash, Eq, and Clone.

§Examples

if let Some(drop_event) = response.drop_event() {
    match drop_event.position {
        DropPosition::Before => {
            insert_before(drop_event.source, drop_event.target);
        }
        DropPosition::After => {
            insert_after(drop_event.source, drop_event.target);
        }
        DropPosition::Inside => {
            make_child_of(drop_event.source, drop_event.target);
        }
    }
}

Fields§

§source: Id

The ID of the node that was dragged.

§target: Id

The ID of the node that the source was dropped onto.

§position: DropPosition

The position where the source should be placed relative to the target.

Implementations§

Source§

impl<Id> DropEvent<Id>
where Id: Hash + Eq + Clone,

Source

pub fn new(source: Id, target: Id, position: DropPosition) -> Self

Creates a new drop event.

§Arguments
  • source - The ID of the node that was dragged
  • target - The ID of the node that was dropped onto
  • position - Where to place the source relative to the target
§Examples
let drop_event = DropEvent::new(
    dragged_id,
    target_id,
    DropPosition::Inside,
);

Trait Implementations§

Source§

impl<Id> Clone for DropEvent<Id>
where Id: Hash + Eq + Clone + Clone,

Source§

fn clone(&self) -> DropEvent<Id>

Returns a duplicate 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<Id> Debug for DropEvent<Id>
where Id: Hash + Eq + Clone + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Id> PartialEq for DropEvent<Id>
where Id: Hash + Eq + Clone + PartialEq,

Source§

fn eq(&self, other: &DropEvent<Id>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Id> Eq for DropEvent<Id>
where Id: Hash + Eq + Clone + Eq,

Source§

impl<Id> StructuralPartialEq for DropEvent<Id>
where Id: Hash + Eq + Clone,

Auto Trait Implementations§

§

impl<Id> Freeze for DropEvent<Id>
where Id: Freeze,

§

impl<Id> RefUnwindSafe for DropEvent<Id>
where Id: RefUnwindSafe,

§

impl<Id> Send for DropEvent<Id>
where Id: Send,

§

impl<Id> Sync for DropEvent<Id>
where Id: Sync,

§

impl<Id> Unpin for DropEvent<Id>
where Id: Unpin,

§

impl<Id> UnwindSafe for DropEvent<Id>
where Id: UnwindSafe,

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

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

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