DragDropSource

Struct DragDropSource 

Source
pub struct DragDropSource<'ui, T> { /* private fields */ }
Expand description

Builder for creating drag drop sources

This struct is created by Ui::drag_drop_source_config and provides a fluent interface for configuring drag sources.

Implementations§

Source§

impl<'ui, T: AsRef<str>> DragDropSource<'ui, T>

Source

pub fn flags(self, flags: DragDropFlags) -> Self

Set flags for this drag source

§Arguments
  • flags - Combination of source-related DragDropFlags
Source

pub fn condition(self, cond: Condition) -> Self

Set condition for when to update the payload

§Arguments
  • cond - When to update the payload data
Source

pub fn begin(self) -> Option<DragDropSourceTooltip<'ui>>

Begin drag source with empty payload

This is the safest option for simple drag and drop operations. Use shared state or other mechanisms to transfer actual data.

Returns a tooltip token if dragging started, None otherwise.

Source

pub fn begin_payload<P: Copy + 'static>( self, payload: P, ) -> Option<DragDropSourceTooltip<'ui>>

Begin drag source with typed payload

The payload data will be copied and managed by ImGui. The data must be Copy + 'static for safety.

§Arguments
  • payload - Data to transfer (must be Copy + ’static)

Returns a tooltip token if dragging started, None otherwise.

Source

pub unsafe fn begin_payload_unchecked( &self, ptr: *const c_void, size: usize, ) -> Option<DragDropSourceTooltip<'ui>>

Begin drag source with raw payload data (unsafe)

§Safety

The caller must ensure:

  • ptr points to valid data of size bytes
  • The data remains valid for the duration of the drag operation
  • The data layout matches what targets expect
§Arguments
  • ptr - Pointer to payload data
  • size - Size of payload data in bytes

Trait Implementations§

Source§

impl<'ui, T: Debug> Debug for DragDropSource<'ui, T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'ui, T> Freeze for DragDropSource<'ui, T>
where T: Freeze,

§

impl<'ui, T> !RefUnwindSafe for DragDropSource<'ui, T>

§

impl<'ui, T> !Send for DragDropSource<'ui, T>

§

impl<'ui, T> !Sync for DragDropSource<'ui, T>

§

impl<'ui, T> Unpin for DragDropSource<'ui, T>
where T: Unpin,

§

impl<'ui, T> !UnwindSafe for DragDropSource<'ui, T>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more