pub fn put_formats(&mut self, formats: &[ClipboardFormat]) {
        unsafe {
            let pasteboard: id = msg_send![class!(NSPasteboard), generalPasteboard];
            let _: NSInteger = msg_send![pasteboard, clearContents];
            let idents = formats
                .iter()
                .map(|f| util::make_nsstring(f.identifier))
                .collect::<Vec<_>>();
            let array = NSArray::arrayWithObjects(nil, &idents);
            let _: NSInteger = msg_send![pasteboard, declareTypes: array owner: nil];
            for (i, format) in formats.iter().enumerate() {
                let data = util::make_nsdata(&format.data);
                let data_type = idents[i];
                let result: BOOL = msg_send![pasteboard, setData: data forType: data_type];
                if result != YES {
                    tracing::warn!(
                        "failed to set clipboard contents for type '{}'",
                        format.identifier
                    );
                }
            }
        }
    }
/// Put multi-format data on the system clipboard.
Put multi-format data on the system clipboard.
Put multi - format data on the system clipboard .
pub fn put_formats(&mut self, formats: &[ClipboardFormat]) {
        unsafe {
            let pasteboard: id = msg_send![class!(NSPasteboard), generalPasteboard];
            let _: NSInteger = msg_send![pasteboard, clearContents];
            let idents = formats
                .iter()
                .map(|f| util::make_nsstring(f.identifier))
                .collect::<Vec<_>>();
            let array = NSArray::arrayWithObjects(nil, &idents);
            let _: NSInteger = msg_send![pasteboard, declareTypes: array owner: nil];
            for (i, format) in formats.iter().enumerate() {
                let data = util::make_nsdata(&format.data);
                let data_type = idents[i];
                let result: BOOL = msg_send![pasteboard, setData: data forType: data_type];
                if result != YES {
                    tracing::warn!(
                        "failed to set clipboard contents for type '{}'",
                        format.identifier
                    );
                }
            }
        }
    }
pub fn put_formats ( & mut self , formats : & [ ClipboardFormat ] ) { unsafe { let pasteboard : id = msg_send ! [ class ( NSPasteboard ) generalPasteboard ] ; let _ : NSInteger = msg_send ! [ pasteboard clearContents ] ; let idents = formats . iter ( ) . map ( | f | util :: make_nsstring ( f . identifier ) ) . collect :: < Vec < _ > > ( ) ; let array = NSArray :: arrayWithObjects ( nil , & idents ) ; let _ : NSInteger = msg_send ! [ pasteboard declareTypes array owner nil ] ; for ( i , format ) in formats . iter ( ) . enumerate ( ) { let data = util :: make_nsdata ( & format . data ) ; let data_type = idents [ i ] ; let result : BOOL = msg_send ! [ pasteboard setData data forType data_type ] ; if result != YES { tracing :: warn ! ( " " format identifier ) ; } } } }
Put multi-format data on the system clipboard.
Put multi - format data on the system clipboard .
&mut self
formats
&[ClipboardFormat]
&mut self
formats
&[ClipboardFormat]