Skip to main content

IDataTransfer

Trait IDataTransfer 

Source
pub trait IDataTransfer: IDisposable {
    // Required methods
    fn formats(&self) -> Rc<[DataFormat]>;
    fn items(&self) -> Rc<[Rc<dyn IDataTransferItem>]>;

    // Provided method
    fn as_async_data_transfer(
        self: Rc<Self>,
    ) -> Option<Rc<dyn IAsyncDataTransfer>> { ... }
}
Expand description

Represents an object providing a list of IDataTransferItem usable during a drag and drop operation.

When an implementation of this interface is used as a drag source using DragDrop::do_drag_drop_async, it must NOT be disposed by the caller. The system will dispose of it automatically when the drag operation completes.

See DataTransfer for the mutable implementation.

Required Methods§

Source

fn formats(&self) -> Rc<[DataFormat]>

Gets the formats supported by the data transfer.

Source

fn items(&self) -> Rc<[Rc<dyn IDataTransferItem>]>

Gets a list of IDataTransferItem contained in this object.

Some platforms (such as Windows and X11) may only support a single data item for all formats except files.

Items returned by this property must stay valid until the data transfer is disposed.

Provided Methods§

Source

fn as_async_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IAsyncDataTransfer>>

The object as an asynchronous data transfer, if it also is one.

Implementations§

Source§

impl dyn IDataTransfer

Source

pub fn to_asynchronous(self: Rc<Self>) -> Rc<dyn IAsyncDataTransfer>

Returns the data transfer as an asynchronous one: itself if it also implements IAsyncDataTransfer, a wrapper otherwise.

This is an implementation detail of the platform backends.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§