#[non_exhaustive]pub enum Error {
ContentNotAvailable,
ClipboardNotSupported,
ClipboardOccupied,
ConversionFailure,
Unknown {
description: String,
},
}
Expand description
An error that might happen during a clipboard operation.
Note that both the Display
and the Debug
trait is implemented for this type in such a way
that they give a short human-readable description of the error; however the documentation
gives a more detailed explanation for each error kind.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ContentNotAvailable
The clipboard contents were not available in the requested format.
This could either be due to the clipboard being empty or the clipboard contents having
an incompatible format to the requested one (eg when calling get_image
on text)
ClipboardNotSupported
The selected clipboard is not supported by the current configuration (system and/or environment).
This can be caused by a few conditions:
- Using the Primary clipboard with an older Wayland compositor (that doesn’t support version 2)
- Using the Secondary clipboard on Wayland
ClipboardOccupied
The native clipboard is not accessible due to being held by an other party.
This “other party” could be a different process or it could be within the same program. So for example you may get this error when trying to interact with the clipboard from multiple threads at once.
Note that it’s OK to have multiple Clipboard
instances. The underlying
implementation will make sure that the native clipboard is only
opened for transferring data and then closed as soon as possible.
ConversionFailure
The image or the text that was about the be transferred to/from the clipboard could not be converted to the appropriate format.
Unknown
Any error that doesn’t fit the other error types.
The description
field is only meant to help the developer and should not be relied on as a
means to identify an error case during runtime.
Trait Implementations§
source§impl Error for Error
impl Error for Error
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more