Struct wl_clipboard_rs::copy::Options
source · [−]pub struct Options { /* private fields */ }
Expand description
Options and flags that are used to customize the copying.
Implementations
sourceimpl 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 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
sourceimpl Ord for Options
impl Ord for Options
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialOrd<Options> for Options
impl PartialOrd<Options> for Options
sourcefn partial_cmp(&self, other: &Options) -> Option<Ordering>
fn partial_cmp(&self, other: &Options) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Options
impl StructuralEq for Options
impl StructuralPartialEq for Options
Auto Trait Implementations
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn 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. Read morefn 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. Read moresourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.