Merge pull request #1231 from TannerRogalsky/allow-the-creation-of-unconnected-clipboard
Allow the creation of a clipboard without a window.
This commit is contained in:
commit
880671e104
1 changed files with 8 additions and 0 deletions
|
|
@ -26,6 +26,14 @@ impl Clipboard {
|
||||||
Clipboard { state }
|
Clipboard { state }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a new [`Clipboard`] that isn't associated with a window.
|
||||||
|
/// This clipboard will never contain a copied value.
|
||||||
|
pub fn unconnected() -> Clipboard {
|
||||||
|
Clipboard {
|
||||||
|
state: State::Unavailable,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Reads the current content of the [`Clipboard`] as text.
|
/// Reads the current content of the [`Clipboard`] as text.
|
||||||
pub fn read(&self) -> Option<String> {
|
pub fn read(&self) -> Option<String> {
|
||||||
match &self.state {
|
match &self.state {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue