pub trait Clipboard: Send + Sync {
// Required methods
fn read(&self) -> Option<String>;
fn write(&self, text: String);
}Expand description
The OS clipboard, behind a swappable backend.
Implementors: ArboardClipboard + OSC52 fallback (TUI, CB.2), the
gpui-native bridge (GPUI peer, CB.4), and FakeClipboard (tests / CI).
All reads/writes are text-only for v1 (images / other MIME are out of
scope).
Required Methods§
Sourcefn read(&self) -> Option<String>
fn read(&self) -> Option<String>
Read the clipboard’s current text. None when the clipboard is empty,
holds non-text content, or the backend can’t read (e.g. OSC52 over SSH,
where read-back is unsupported — the register layer falls back to its
in-memory entry). Only called from a spawn_blocking context.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".