pub struct Options { /* private fields */ }
Expand description
Options and flags that are used to customize the copying.
Implementations§
source§impl Options
impl Options
sourcepub fn clipboard(&mut self, clipboard: ClipboardType) -> &mut Self
pub fn clipboard(&mut self, clipboard: ClipboardType) -> &mut Self
Sets the clipboard to work with.
sourcepub fn trim_newline(&mut self, trim_newline: bool) -> &mut Self
pub fn trim_newline(&mut self, trim_newline: bool) -> &mut Self
Sets the flag for trimming the trailing newline.
This flag is only applied for text MIME types.
sourcepub fn foreground(&mut self, foreground: bool) -> &mut Self
pub fn foreground(&mut self, foreground: bool) -> &mut Self
Sets the flag for not spawning a separate thread for serving copy requests.
Setting this flag will result in the call to copy()
blocking until all data sources
it creates are destroyed, e.g. until someone else copies something into the clipboard.
sourcepub fn serve_requests(&mut self, serve_requests: ServeRequests) -> &mut Self
pub fn serve_requests(&mut self, serve_requests: ServeRequests) -> &mut Self
Sets the number of requests to serve.
Limiting the number of requests to one effectively clears the clipboard after the first paste. It can be used when copying e.g. sensitive data, like passwords. Note however that certain apps may have issues pasting when this option is used, in particular XWayland clients are known to suffer from this.
sourcepub fn omit_additional_text_mime_types(
&mut self,
omit_additional_text_mime_types: bool,
) -> &mut Self
pub fn omit_additional_text_mime_types( &mut self, omit_additional_text_mime_types: bool, ) -> &mut Self
Sets the flag for omitting additional text mime types which are offered by default if at least one text mime type is provided.
Omits additionally offered text/plain;charset=utf-8
, text/plain
, STRING
, UTF8_STRING
and
TEXT
mime types which are offered by default if at least one text mime type is provided.
sourcepub fn copy(self, source: Source, mime_type: MimeType) -> Result<(), Error>
pub fn copy(self, source: Source, mime_type: MimeType) -> Result<(), Error>
Invokes the copy operation. See copy()
.
§Examples
use wl_clipboard_rs::copy::{MimeType, Options, Source};
let opts = Options::new();
opts.copy(Source::Bytes([1, 2, 3][..].into()), MimeType::Autodetect)?;
sourcepub fn copy_multi(self, sources: Vec<MimeSource>) -> Result<(), Error>
pub fn copy_multi(self, sources: Vec<MimeSource>) -> Result<(), Error>
Invokes the copy_multi operation. See copy_multi()
.
§Examples
use wl_clipboard_rs::copy::{MimeSource, MimeType, Options, Source};
let opts = Options::new();
opts.copy_multi(vec![MimeSource { source: Source::Bytes([1, 2, 3][..].into()),
mime_type: MimeType::Autodetect },
MimeSource { source: Source::Bytes([7, 8, 9][..].into()),
mime_type: MimeType::Text }])?;
sourcepub fn prepare_copy(
self,
source: Source,
mime_type: MimeType,
) -> Result<PreparedCopy, Error>
pub fn prepare_copy( self, source: Source, mime_type: MimeType, ) -> Result<PreparedCopy, Error>
Invokes the prepare_copy operation. See prepare_copy()
.
§Panics
Panics if foreground
is false
.
§Examples
use wl_clipboard_rs::copy::{MimeSource, MimeType, Options, Source};
let mut opts = Options::new();
opts.foreground(true);
let prepared_copy = opts.prepare_copy(Source::Bytes([1, 2, 3][..].into()),
MimeType::Autodetect)?;
prepared_copy.serve()?;
sourcepub fn prepare_copy_multi(
self,
sources: Vec<MimeSource>,
) -> Result<PreparedCopy, Error>
pub fn prepare_copy_multi( self, sources: Vec<MimeSource>, ) -> Result<PreparedCopy, Error>
Invokes the prepare_copy_multi operation. See prepare_copy_multi()
.
§Panics
Panics if foreground
is false
.
§Examples
use wl_clipboard_rs::copy::{MimeSource, MimeType, Options, Source};
let mut opts = Options::new();
opts.foreground(true);
let prepared_copy =
opts.prepare_copy_multi(vec![MimeSource { source: Source::Bytes([1, 2, 3][..].into()),
mime_type: MimeType::Autodetect },
MimeSource { source: Source::Bytes([7, 8, 9][..].into()),
mime_type: MimeType::Text }])?;
prepared_copy.serve()?;
Trait Implementations§
source§impl Ord for Options
impl Ord for Options
source§impl PartialOrd for Options
impl PartialOrd for Options
impl Eq for Options
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.