Struct zng_ext_clipboard::CLIPBOARD
source · 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::ViewProcessOffline
.
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<bool, ClipboardError>>
pub fn set_text( &self, txt: impl Into<Txt>, ) -> ResponseVar<Result<bool, ClipboardError>>
Sets the text string on the clipboard after the current update.
Returns a response var that updates to Ok(true)
is the text is put on the clipboard,
Ok(false)
if another request made on the same update pass replaces this one or Err(ClipboardError)
.
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 and cached by the IMAGES
service.
sourcepub fn set_image(&self, img: Img) -> ResponseVar<Result<bool, ClipboardError>>
pub fn set_image(&self, img: Img) -> ResponseVar<Result<bool, ClipboardError>>
Set the image on the clipboard after the current update, if it is loaded.
Returns a response var that updates to Ok(true)
is the text is put on the clipboard,
Ok(false)
if another request made on the same update pass replaces this one or Err(ClipboardError)
.
sourcepub fn file_list(&self) -> Result<Option<Vec<PathBuf>>, ClipboardError>
pub fn file_list(&self) -> Result<Option<Vec<PathBuf>>, ClipboardError>
Gets a file list from the clipboard.
sourcepub fn set_file_list(
&self,
list: impl Into<Vec<PathBuf>>,
) -> ResponseVar<Result<bool, ClipboardError>>
pub fn set_file_list( &self, list: impl Into<Vec<PathBuf>>, ) -> ResponseVar<Result<bool, ClipboardError>>
Sets the file list on the clipboard after the current update.
Returns a response var that updates to Ok(true)
is the text is put on the clipboard,
Ok(false)
if another request made on the same update pass replaces this one or Err(ClipboardError)
.
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<bool, ClipboardError>>
pub fn set_extension( &self, data_type: impl Into<Txt>, data: IpcBytes, ) -> ResponseVar<Result<bool, ClipboardError>>
Set a custom data on the clipboard.
The current view-process must support data_type
after the current update.
Returns a response var that updates to Ok(true)
is the text is put on the clipboard,
Ok(false)
if another request made on the same update pass replaces this one or Err(ClipboardError)
.
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