pub trait DataTransfer: Any + Debug {
// Required method
fn for_each_available_type<'this>(
&'this self,
func: &mut dyn FnMut(&'this dyn TransferType) -> ControlFlow<()>,
);
// Provided methods
fn available_types(&self) -> Vec<&dyn TransferType> { ... }
fn has_type(&self, type_: &dyn TransferType) -> bool { ... }
}Expand description
Metadata about a data transfer. This does not allow actually receiving data, as that is an
asynchronous operation. To fetch the data from the source application, see
ActiveEventLoop::fetch_data_transfer.
Required Methods§
Sourcefn for_each_available_type<'this>(
&'this self,
func: &mut dyn FnMut(&'this dyn TransferType) -> ControlFlow<()>,
)
fn for_each_available_type<'this>( &'this self, func: &mut dyn FnMut(&'this dyn TransferType) -> ControlFlow<()>, )
Iterate over each type advertized by this DataTransfer. This is just a minor optimization,
in most cases you should probably use has_type or
available_types.
Provided Methods§
Sourcefn available_types(&self) -> Vec<&dyn TransferType>
fn available_types(&self) -> Vec<&dyn TransferType>
Display the list of all available types.
This is useful if more-complex type matching is required, but for most cases
has_type should be used.
Sourcefn has_type(&self, type_: &dyn TransferType) -> bool
fn has_type(&self, type_: &dyn TransferType) -> bool
Check if the supplied type is provided by this DataTransfer.
Supplying a TypeHint as the type is supported on all platforms, but if some
platform-specific type is required then that platform’s implementation of TransferType can
be used.
Implementations§
Source§impl dyn DataTransfer + '_
impl dyn DataTransfer + '_
Sourcepub fn cast_ref<T: DataTransfer>(&self) -> Option<&T>
pub fn cast_ref<T: DataTransfer>(&self) -> Option<&T>
Downcast to the backend concrete type.
Returns None if the object was not from that backend.
Sourcepub fn cast_mut<T: DataTransfer>(&mut self) -> Option<&mut T>
pub fn cast_mut<T: DataTransfer>(&mut self) -> Option<&mut T>
Mutable downcast to the backend concrete type.
Returns None if the object was not from that backend.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".