pub trait ClipTarget {
// Required methods
fn accepts(&self, app: &AppHandle) -> Vec<FormatId>;
fn paste(&self, app: &AppHandle, paste: &Paste<'_>) -> Result<Json, String>;
// Provided methods
fn apply(&self, app: &AppHandle, paste: &Paste<'_>) -> Pasted { ... }
fn context(&self, app: &AppHandle, element: Option<&str>) -> Json { ... }
}Expand description
Where a paste goes in a component.
Required Methods§
Provided Methods§
Sourcefn apply(&self, app: &AppHandle, paste: &Paste<'_>) -> Pasted
fn apply(&self, app: &AppHandle, paste: &Paste<'_>) -> Pasted
Applies a paste (never a dry run: paste special’s previews and an
agent’s plan go through ClipTarget::paste). A target whose
edit goes through the application’s own loop (a network edit, a
viewport command applied next frame) answers Pasted::Later
with a result to come (crate::host::pending): its writes still
carry paste.group, which stays open until the result arrives,
so the paste remains one undo step; the result is published as
clipboard.pasted and a failure shown to the user. By default,
ClipTarget::paste now.
Sourcefn context(&self, app: &AppHandle, element: Option<&str>) -> Json
fn context(&self, app: &AppHandle, element: Option<&str>) -> Json
What a transform may know of the target before adapting a paste
to it (Transform::for_target): the image a mask lands on, the
range a value is clamped to, the names a pasted one must not
take. element is the element pasted into, if any. Nothing by
default.