Skip to main content

InProcessClipboard

Struct InProcessClipboard 

Source
pub struct InProcessClipboard { /* private fields */ }
Expand description

A clipboard private to this process, for a host that performs nothing outside it: the inert services a test runs an app with, the session shell’s primary selection, and Android’s select-to-copy.

Keeps copy → paste round-tripping inside the process. It refuses ClipboardBackend::set_shared_text, secrets and images.

Trait Implementations§

Source§

impl ClipboardBackend for InProcessClipboard

Source§

fn set_text(&self, target: ClipboardTarget, text: &str) -> bool

Source§

fn text(&self, target: ClipboardTarget) -> Option<String>

Read target as UTF-8. None when it is empty, unavailable, or holds something that is not text.
Source§

fn set_rich_text(&self, html: &str, plain: &str) -> bool

Take the Ctrl+C clipboard and offer formatted text on it: html as text/html and plain as its plain-text fallback, both from one copy, so an app that reads formatting pastes the formatting and every other app the words. Returns false if the backend could not. Read more
Source§

fn rich_text(&self) -> Option<RichTextOffer>

Read HTML and its plain fallback from one Ctrl+V clipboard offer. Optional: unsupported backends return None without reading plain text. A successful read consumes event-scoped offers; use the captured plain fallback if decoding refuses the HTML. Never reread to recover a stale selection, a permission refusal, or an active composition.
Source§

fn set_shared_text(&self, _target: ClipboardTarget, _text: &str) -> bool

Offer text only where other processes can read it. Returns false rather than keeping it in a buffer private to this process, so a secret is never reported as copied when it was not. The default is set_text, right for a backend that only reaches a shared clipboard.
Source§

fn name(&self) -> &'static str

Source§

fn request_text(&self, target: ClipboardTarget) -> Receiver<Option<String>>

Request text for an explicit paste. A native transfer may finish after this call returns; the backend must wake its owner when it answers. No answer may substitute text from an older selection or focus owner.
Source§

fn set_image(&self, width: usize, height: usize, rgba: &[u8]) -> bool

Offer an RGBA8 image on the clipboard. Optional: the default refuses, which is appropriate for backends that only carry text.
Source§

fn image(&self) -> Option<ClipboardImage>

The image on the Ctrl+V clipboard, when it holds one: a screenshot, an image copied in a viewer or a browser. Optional: the default reads none, which is right for backends that only carry text.
Source§

fn set_secret_text(&self, text: &str) -> bool

Offer text on the Ctrl+V clipboard marked as a secret: a password, a one-time code, an enrolment token. Other apps can still paste it as plain text, but clipboard managers and Tilo’s own history and device sync are told not to keep it (SECRET_MIME, PASSWORD_MANAGER_HINT_MIME). Read more
Source§

fn copy(&self, content: CopyContent<'_>) -> ClipboardCopy

Start a Ctrl+C copy without waiting for it, and answer its outcome through the returned ClipboardCopy. A copy through an app’s own Wayland connection waits on compositor roundtrips; this lets the UI thread go on while it does, and wakes the app when it settles. Read more
Source§

fn reserve_text(&self) -> Option<ReservedCopy>

Hold a Ctrl+C copy for text that is not known yet: a link the person’s click asks a host for. A browser copies only inside the click, so a backend with that rule claims the clipboard now and fills it once ReservedCopy::fill hands the text over. None when this backend copies just as well later, or has no way to claim the clipboard now; the text is then copied when it arrives.
Source§

impl Debug for InProcessClipboard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for InProcessClipboard

Source§

fn default() -> InProcessClipboard

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more