pub struct ClipboardEventListener { /* private fields */ }Expand description
Clipboard event change listener.
Listen for clipboard change events and notifies ClipboardStream.
Implementations§
Source§impl ClipboardEventListener
impl ClipboardEventListener
Sourcepub fn spawn() -> Self
pub fn spawn() -> Self
Creates a new ClipboardEventListener that monitors clipboard changes in a dedicated OS thread.
Sourcepub fn new_stream(
&mut self,
kind: Kind,
buffer: usize,
) -> Result<ClipboardStream, Error>
pub fn new_stream( &mut self, kind: Kind, buffer: usize, ) -> Result<ClipboardStream, Error>
Creates a ClipboardStream for receiving clipboard change items as Body.
If a stream for the same Kind already exists, returns Error::StreamAlreadyExists.
§Buffer size
This method takes a buffer size. Items are buffered when not received immediately.
The actual buffer capacity is buf_size + 2, where the extra 2 accounts for the
number of internal senders used by the library.
§Example
let mut event_listener = ClipboardEventListener::spawn();
let buf_size = 32;
let stream = event_listener.new_stream(Kind::Utf8String, buf_size)?;Trait Implementations§
Source§impl Default for ClipboardEventListener
impl Default for ClipboardEventListener
Auto Trait Implementations§
impl Freeze for ClipboardEventListener
impl !RefUnwindSafe for ClipboardEventListener
impl Send for ClipboardEventListener
impl Sync for ClipboardEventListener
impl Unpin for ClipboardEventListener
impl !UnwindSafe for ClipboardEventListener
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more