[][src]Struct clipboard_win::Clipboard

pub struct Clipboard { /* fields omitted */ }

Clipboard accessor.


You can have only one such accessor across your program.


In Windows Clipboard opens globally and only one application can set data onto format at the time.

Therefore as soon as operations are finished, user is advised to close Clipboard.


impl Clipboard[src]

pub fn new() -> Result<Clipboard>[src]

Initializes new clipboard accessor.

Attempts to open clipboard.

pub fn new_attempts(num: usize) -> Result<Clipboard>[src]

Attempts to initialize clipboard num times before giving up.

pub fn empty(&self) -> Result<&Clipboard>[src]

Empties clipboard.

pub fn size(&self, format: u32) -> Option<usize>[src]

Retrieves size of clipboard content.

pub fn set(&self, format: u32, data: &[u8]) -> Result<()>[src]

Sets data onto clipboard with specified format.

Wraps raw::set()

pub fn set_string(&self, text: &str) -> Result<()>[src]

Sets str or String onto clipboard as Unicode format.

Under hood it transforms Rust UTF-8 String into UTF-16

pub fn get(&self, format: u32, data: &mut [u8]) -> Result<usize>[src]

Retrieves data of specified format from clipboard.

Wraps raw::get()

pub fn get_string(&self, storage: &mut String) -> Result<()>[src]

Retrieves String of CF_UNICODETEXT format from clipboard.

Wraps raw::get_string()

pub fn get_file_list(&self) -> Result<Vec<PathBuf>>[src]

Retrieves a list of file paths from the CF_HDROP format from the clipboard.

Wraps raw::get_file_list()

pub fn get_dib(&self) -> Result<Image>[src]

Retrieves Bitmap of CF_DIB

Important traits for EnumFormats
pub fn enum_formats(&self) -> EnumFormats[src]

Enumerator over all formats on clipboard..

pub fn seq_num() -> Option<u32>[src]

Returns Clipboard sequence number.

pub fn is_format_avail(format: u32) -> bool[src]

Determines whenever provided clipboard format is available on clipboard or not.

pub fn count_formats() -> Result<i32>[src]

Retrieves number of currently available formats on clipboard.

Trait Implementations

impl Drop for Clipboard[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.