Struct cacao::pasteboard::Pasteboard
source · [−]Expand description
Represents an NSPasteboard
, enabling you to handle copy/paste/drag and drop.
Tuple Fields
0: ShareId<Object>
Implementations
sourceimpl Pasteboard
impl Pasteboard
sourcepub fn named(name: PasteboardName) -> Self
pub fn named(name: PasteboardName) -> Self
Retrieves the system Pasteboard for the given name/type.
sourcepub fn unique() -> Self
pub fn unique() -> Self
Creates and returns a new pasteboard with a name that is guaranteed to be unique with respect to other pasteboards in the system.
sourcepub fn copy_text<S: AsRef<str>>(&self, text: S)
pub fn copy_text<S: AsRef<str>>(&self, text: S)
A shorthand helper method for copying some text to the clipboard.
sourcepub fn release_globally(&self)
pub fn release_globally(&self)
Releases the receiver’s resources in the pasteboard server. It’s rare-ish to need to use this, but considering this stuff happens on the Objective-C side you may need it.
sourcepub fn clear_contents(&self)
pub fn clear_contents(&self)
Clears the existing contents of the pasteboard.
sourcepub fn get_file_urls(&self) -> Result<Vec<NSURL<'_>>, Box<dyn Error>>
pub fn get_file_urls(&self) -> Result<Vec<NSURL<'_>>, Box<dyn Error>>
Looks inside the pasteboard contents and extracts what FileURLs are there, if any.
Note that this method returns a list of Url
entities, in an attempt to be closer to how
Cocoa & co operate. This method may go away in the future if it’s determined that people
wind up just using get_file_paths()
.
Trait Implementations
sourceimpl Debug for Pasteboard
impl Debug for Pasteboard
sourceimpl Default for Pasteboard
impl Default for Pasteboard
Auto Trait Implementations
impl RefUnwindSafe for Pasteboard
impl Send for Pasteboard
impl Sync for Pasteboard
impl Unpin for Pasteboard
impl UnwindSafe for Pasteboard
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more