[][src]Struct wl_clipboard_rs::copy::Options

pub struct Options { /* fields omitted */ }

Options and flags that are used to customize the copying.

Implementations

impl Options[src]

pub fn new() -> Self[src]

Creates a blank new set of options ready for configuration.

pub fn clipboard(&mut self, clipboard: ClipboardType) -> &mut Self[src]

Sets the clipboard to work with.

pub fn seat(&mut self, seat: Seat) -> &mut Self[src]

Sets the seat to use for copying.

pub fn trim_newline(&mut self, trim_newline: bool) -> &mut Self[src]

Sets the flag for trimming the trailing newline.

This flag is only applied for text MIME types.

pub fn foreground(&mut self, foreground: bool) -> &mut Self[src]

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.

pub fn serve_requests(&mut self, serve_requests: ServeRequests) -> &mut Self[src]

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.

pub fn copy(self, source: Source, mime_type: MimeType) -> Result<(), Error>[src]

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)?;

pub fn copy_multi(self, sources: Vec<MimeSource>) -> Result<(), Error>[src]

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 }])?;

pub fn prepare_copy(
    self,
    source: Source,
    mime_type: MimeType
) -> Result<PreparedCopy, Error>
[src]

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()?;

pub fn prepare_copy_multi(
    self,
    sources: Vec<MimeSource>
) -> Result<PreparedCopy, Error>
[src]

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

impl Clone for Options[src]

impl Debug for Options[src]

impl Default for Options[src]

impl Eq for Options[src]

impl Hash for Options[src]

impl Ord for Options[src]

impl PartialEq<Options> for Options[src]

impl PartialOrd<Options> for Options[src]

impl StructuralEq for Options[src]

impl StructuralPartialEq for Options[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,