Expand description
Plain text on the platform clipboard, written and read from application code.
Copying what the user selected is the Renderer’s own business and never comes through here. This is the other way in: a “Copy link” button whose text the application already holds. The Host asks with one command record on the batch the current call produces, and the Renderer puts the text on the clipboard through Compose. Nothing comes back: a write either lands or, where there is no clipboard to write to, is dropped quietly.
A read goes the same way and does come back: read_text numbers the request, the
Renderer reads the clipboard through Compose, and one ClipboardText event with that
number carries the text, or says there was none, or that there was too much. Every read
gets exactly one answer.
Anything on the clipboard can be read by every other application and by clipboard history tools, so this is not the way to copy a password, a token or a private key.
Modules§
- read_
status - What the clipboard held when a read was answered, as the wire says it.
Structs§
- Clipboard
- The platform clipboard, as a value a component can hold. Compose’s
LocalClipboard.
Enums§
- Clipboard
Error - Why a clipboard write was refused before anything was sent, or a read brought no text.
Constants§
- MAX_
TEXT_ BYTES - The longest text one call may put on or read from the clipboard, in UTF-8 bytes.
Functions§
- read_
text - Reads the plain text on the platform clipboard and calls
on_textonce with it. - read_
text_ async read_textas a future, for a coroutine scope or a launched effect.- set_
text - Puts
texton the platform clipboard as plain text, replacing what was there. - use_
clipboard - The platform clipboard. Free to call anywhere, including during composition.
Type Aliases§
- Read
Result - The result of one read: the text,
Nonewhen there was no plain text, orClipboardError::TooLongwhen there was more than one read may carry. Over-long text is never cut short, so an application can refuse the paste instead of pasting part.