Merge pull request #1 from simlay/ios-unimplemented-stub
This is a stub of the iOS clipboard logic.
This commit is contained in:
commit
8161059964
2 changed files with 37 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
unix,
|
unix,
|
||||||
not(any(
|
not(any(
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "emscripten"
|
target_os = "emscripten"
|
||||||
))
|
))
|
||||||
|
|
@ -12,6 +13,7 @@ mod platform;
|
||||||
#[cfg(not(all(
|
#[cfg(not(all(
|
||||||
unix,
|
unix,
|
||||||
not(any(
|
not(any(
|
||||||
|
target_os = "ios",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "emscripten"
|
target_os = "emscripten"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ pub fn new_clipboard<W: HasRawWindowHandle>(
|
||||||
{
|
{
|
||||||
Ok(Box::new(clipboard_macos::Clipboard::new()?))
|
Ok(Box::new(clipboard_macos::Clipboard::new()?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "ios")]
|
||||||
|
{
|
||||||
|
Ok(Box::new(clipboard_ios::Clipboard::new()?))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|
@ -30,3 +35,33 @@ impl ClipboardProvider for clipboard_macos::Clipboard {
|
||||||
self.read()
|
self.read()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(target_os = "ios")]
|
||||||
|
mod clipboard_ios {
|
||||||
|
use std::error::Error;
|
||||||
|
pub struct Clipboard;
|
||||||
|
impl Clipboard {
|
||||||
|
pub fn new() -> Result<Clipboard, Box<dyn Error>> {
|
||||||
|
Ok(Self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub enum iOSClipboardError {
|
||||||
|
Unimplemented,
|
||||||
|
}
|
||||||
|
impl std::fmt::Display for iOSClipboardError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "Unimplemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Error for iOSClipboardError { }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "ios")]
|
||||||
|
impl ClipboardProvider for clipboard_ios::Clipboard {
|
||||||
|
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||||
|
Err(Box::new(clipboard_ios::iOSClipboardError::Unimplemented))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue