Clipboard API review

rust-clipboard was a bit lacking, especially because it only let me copy text, and didn't allow for multiple things to be on the clipboard at once, so I tried to make a library that worked on all platforms and provided these features. Do you think this API is idiomatic and easy-to-use? :slight_smile:

// Clipboard

pub struct Clipboard { ... }

impl Clipboard {
    pub fn new() -> io::Result<Clipboard>;
    pub fn formats<'a>(&'a self, index: usize) -> io::Result<Formats<'a>>;
    pub fn get(&self, index: usize, format: &Format) -> io::Result<Vec<u8>>;
    pub fn set(&self, versions: &[(&Format, &[u8])]);
    pub fn clear(&self);

// Formats

pub struct Formats<'a> { ... }

impl<'a> Iterator for Formats<'a> {
    type Item = Format;

// Format

pub struct Format { ... }

impl Format {
    pub fn new(mime: &'static str) -> Format;

impl Clone for Format { ... }
impl PartialEq for Format { ... }
impl Eq for Format {}

Note that although you can get multiple clipboard entries, you can only set one.

This interface certain looks more friendly than that of rust-clipboard :thumbsup:

(xxxProvider and xxxContext stuff is sooo Java)