pub fn put_string(&mut self, string: impl AsRef<str>) {
        let string = string.as_ref().to_string();

        let display = gtk::gdk::Display::default().unwrap();
        let clipboard = gtk::Clipboard::for_display(&display, &self.selection);

        let targets: Vec<TargetEntry> = CLIPBOARD_TARGETS
            .iter()
            .enumerate()
            .map(|(i, target)| TargetEntry::new(target, TargetFlags::all(), i as u32))
            .collect();

        clipboard.set_with_data(&targets, move |_, selection, _| {
            const STRIDE_BITS: i32 = 8;
            selection.set(&selection.target(), STRIDE_BITS, string.as_bytes());
        });
    }
/// Put a string onto the system clipboard.
Put a string onto the system clipboard.
Put a string onto the system clipboard .
pub fn put_string(&mut self, string: impl AsRef<str>) {
        let string = string.as_ref().to_string();
        let display = gtk::gdk::Display::default().unwrap();
        let clipboard = gtk::Clipboard::for_display(&display, &self.selection);
        let targets: Vec<TargetEntry> = CLIPBOARD_TARGETS
            .iter()
            .enumerate()
            .map(|(i, target)| TargetEntry::new(target, TargetFlags::all(), i as u32))
            .collect();
        clipboard.set_with_data(&targets, move |_, selection, _| {
            const STRIDE_BITS: i32 = 8;
            selection.set(&selection.target(), STRIDE_BITS, string.as_bytes());
        });
    }
pub fn put_string ( & mut self , string : impl AsRef < str > ) { let string = string . as_ref ( ) . to_string ( ) ; let display = gtk :: gdk :: Display :: default ( ) . unwrap ( ) ; let clipboard = gtk :: Clipboard :: for_display ( & display , & self . selection ) ; let targets : Vec < TargetEntry > = CLIPBOARD_TARGETS . iter ( ) . enumerate ( ) . map ( | ( i , target ) | TargetEntry :: new ( target , TargetFlags :: all ( ) , i as u32 ) ) . collect ( ) ; clipboard . set_with_data ( & targets , move | _ , selection , _ | { const STRIDE_BITS : i32 = 8 ; selection . set ( & selection . target ( ) , STRIDE_BITS , string . as_bytes ( ) ) ; } ) ; }
Put a string onto the system clipboard.
Put a string onto the system clipboard .
&mut self
string
impl AsRef<str>
&mut self
string
impl AsRef<str>