pub struct CLIPBOARD;Expand description
Clipboard service.
This service synchronizes with the UI update cycle, the getter methods provide the same data for all requests in the same update pass, even if the system clipboard happens to change mid update, the setter methods only set the system clipboard at the end of the update pass.
This service needs a running view-process to actually interact with the system clipboard, in a headless app
without renderer (no view-process) the service will always return ClipboardError::Disconnected.
Implementations§
Source§impl CLIPBOARD
impl CLIPBOARD
Sourcepub fn text(&self) -> Result<Option<Txt>, ClipboardError>
pub fn text(&self) -> Result<Option<Txt>, ClipboardError>
Gets a text string from the clipboard.
Sourcepub fn set_text(
&self,
txt: impl Into<Txt>,
) -> ResponseVar<Result<(), ClipboardError>>
pub fn set_text( &self, txt: impl Into<Txt>, ) -> ResponseVar<Result<(), ClipboardError>>
Sets the text string on the clipboard after the current update.
Returns a response var that updates once the text is set.
Sourcepub fn image(&self) -> Result<Option<ImageVar>, ClipboardError>
pub fn image(&self) -> Result<Option<ImageVar>, ClipboardError>
Gets an image from the clipboard.
The image is loaded in parallel by the IMAGES service, it is not cached.
Sourcepub fn set_image(
&self,
img: ImageEntry,
) -> ResponseVar<Result<(), ClipboardError>>
pub fn set_image( &self, img: ImageEntry, ) -> ResponseVar<Result<(), ClipboardError>>
Set the image on the clipboard after the current update, if it is loaded.
Returns a response var that updates once the image is set.
Sourcepub fn paths(&self) -> Result<Option<Vec<PathBuf>>, ClipboardError>
pub fn paths(&self) -> Result<Option<Vec<PathBuf>>, ClipboardError>
Gets a path list from the clipboard.
Sourcepub fn set_paths(
&self,
list: impl Into<Vec<PathBuf>>,
) -> ResponseVar<Result<(), ClipboardError>>
pub fn set_paths( &self, list: impl Into<Vec<PathBuf>>, ) -> ResponseVar<Result<(), ClipboardError>>
Sets the file list on the clipboard after the current update.
Returns a response var that updates once the paths are set.
Sourcepub fn extension(
&self,
data_type: impl Into<Txt>,
) -> Result<Option<IpcBytes>, ClipboardError>
pub fn extension( &self, data_type: impl Into<Txt>, ) -> Result<Option<IpcBytes>, ClipboardError>
Gets custom data from the clipboard.
The current view-process must support data_type.
Sourcepub fn set_extension(
&self,
data_type: impl Into<Txt>,
data: IpcBytes,
) -> ResponseVar<Result<(), ClipboardError>>
pub fn set_extension( &self, data_type: impl Into<Txt>, data: IpcBytes, ) -> ResponseVar<Result<(), ClipboardError>>
Set a custom data on the clipboard.
The current view-process must support data_type after the current update.
Sourcepub fn available_types(&self) -> ClipboardTypes
pub fn available_types(&self) -> ClipboardTypes
Get what clipboard types and operations the current view-process implements.
Auto Trait Implementations§
impl Freeze for CLIPBOARD
impl RefUnwindSafe for CLIPBOARD
impl Send for CLIPBOARD
impl Sync for CLIPBOARD
impl Unpin for CLIPBOARD
impl UnwindSafe for CLIPBOARD
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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