RichTextTransfer
struct · ferroui-controls · v0.5.0
struct RichTextTransfer
Framework-native clipboard exchange. In-process transfers retain the exact immutable document fragment, including inline controls; external applications receive text and RTF.
Members
document_formatrtf_formatscreatecreate_with_default_tab_stopreadread_for_insertioncan_readread_with_formatread_with_format_for_insertion
document_format
fn document_format() -> DataFormatOf<DocumentSnapshot>
rtf_formats
fn rtf_formats() -> Vec<DataFormatOf<Rc<[u8]>>>
create
fn create(fragment: &DocumentSnapshot, format: RichEditClipboardFormat) -> Rc<dyn IAsyncDataTransfer>
Builds one clipboard item containing all applicable formats. If a rich feature has no RTF representation, the exact in-process fragment and plain text are still offered.
create_with_default_tab_stop
fn create_with_default_tab_stop(fragment: &DocumentSnapshot, format: RichEditClipboardFormat, default_tab_stop: f64) -> Rc<dyn IAsyncDataTransfer>
Includes RTF using the owning editor's default interval while retaining the exact original snapshot in the in-process clipboard format.
read
async fn read(data: &dyn IAsyncDataTransfer, plain_text_only: bool) -> Result<Option<DocumentSnapshot>, ClipboardError>
Reads the highest-fidelity offered format. A malformed advertised RTF payload is reported to the caller instead of silently replacing formatted content with text.
read_for_insertion
async fn read_for_insertion(data: &dyn IAsyncDataTransfer, plain_text_only: bool, default_tab_stop: f64) -> Result<Option<DocumentSnapshot>, ClipboardError>
Imports external RTF for insertion into an existing editor. Its document default is replaced by the destination's interval; explicit stops remain. Exact in-process fragments retain their paragraph formatting unchanged.
can_read
fn can_read(data: &dyn IAsyncDataTransfer, format: RichTextPasteFormat) -> Result<bool, ClipboardError>
Checks advertised formats without requesting or decoding their payloads. A true result does not promise that a later platform read will succeed or that an advertised RTF payload is well formed.
read_with_format
async fn read_with_format(data: &dyn IAsyncDataTransfer, format: RichTextPasteFormat) -> Result<Option<DocumentSnapshot>, ClipboardError>
Reads exactly the requested representation policy. The caller retains
ownership of data and is responsible for disposing a retrieved transfer.
read_with_format_for_insertion
async fn read_with_format_for_insertion(data: &dyn IAsyncDataTransfer, format: RichTextPasteFormat, default_tab_stop: f64) -> Result<Option<DocumentSnapshot>, ClipboardError>
Reads a chosen format for an existing editor, applying its default tab interval to external RTF while retaining explicit paragraph tab stops.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.