pub fn preferred_format(&self, formats: &[FormatId]) -> Option<FormatId> {
        let display = gtk::gdk::Display::default().unwrap();
        let clipboard = gtk::Clipboard::for_display(&display, &self.selection);

        let targets = clipboard.wait_for_targets()?;
        let format_atoms = formats
            .iter()
            .map(|fmt| Atom::intern(fmt))
            .collect::<Vec<_>>();
        for atom in targets.iter() {
            if let Some(idx) = format_atoms.iter().position(|fmt| fmt == atom) {
                return Some(formats[idx]);
            }
        }
        None
    }
/// Given a list of supported clipboard types, returns the supported type which has
/// highest priority on the system clipboard, or `None` if no types are supported.
Given a list of supported clipboard types, returns the supported type which has
highest priority on the system clipboard, or `None` if no types are supported.
Given a list of supported clipboard types returns the supported type which has highest priority on the system clipboard or ` None ` if no types are supported .
pub fn preferred_format(&self, formats: &[FormatId]) -> Option<FormatId> {
        let display = gtk::gdk::Display::default().unwrap();
        let clipboard = gtk::Clipboard::for_display(&display, &self.selection);
        let targets = clipboard.wait_for_targets()?;
        let format_atoms = formats
            .iter()
            .map(|fmt| Atom::intern(fmt))
            .collect::<Vec<_>>();
        for atom in targets.iter() {
            if let Some(idx) = format_atoms.iter().position(|fmt| fmt == atom) {
                return Some(formats[idx]);
            }
        }
        None
    }
pub fn preferred_format ( & self , formats : & [ FormatId ] ) -> Option < FormatId > { let display = gtk :: gdk :: Display :: default ( ) . unwrap ( ) ; let clipboard = gtk :: Clipboard :: for_display ( & display , & self . selection ) ; let targets = clipboard . wait_for_targets ( ) ? ; let format_atoms = formats . iter ( ) . map ( | fmt | Atom :: intern ( fmt ) ) . collect :: < Vec < _ > > ( ) ; for atom in targets . iter ( ) { if let Some ( idx ) = format_atoms . iter ( ) . position ( | fmt | fmt == atom ) { return Some ( formats [ idx ] ) ; } } None }
Given a list of supported clipboard types, returns the supported type which has
highest priority on the system clipboard, or `None` if no types are supported.
Given a list of supported clipboard types returns the supported type which has highest priority on the system clipboard or ` None ` if no types are supported .
&self
formats
&[FormatId]
&self
formats
&[FormatId]