Add stub for android, with unimplemented error.
This commit is contained in:
parent
3a9cf35718
commit
38a389b019
2 changed files with 42 additions and 0 deletions
|
|
@ -22,6 +22,10 @@ mod platform;
|
|||
#[path = "platform/ios.rs"]
|
||||
mod platform;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[path = "platform/android.rs"]
|
||||
mod platform;
|
||||
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
use std::error::Error;
|
||||
|
||||
|
|
|
|||
38
src/platform/android.rs
Normal file
38
src/platform/android.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
use crate::ClipboardProvider;
|
||||
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
use std::error::Error;
|
||||
|
||||
pub fn new_clipboard<W: HasRawWindowHandle>(
|
||||
_window: &W,
|
||||
) -> Result<Box<dyn ClipboardProvider>, Box<dyn Error>> {
|
||||
Ok(Box::new(Clipboard::new()?))
|
||||
}
|
||||
|
||||
pub struct Clipboard;
|
||||
|
||||
impl Clipboard {
|
||||
pub fn new() -> Result<Clipboard, Box<dyn Error>> {
|
||||
Ok(Self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum AndroidClipboardError {
|
||||
Unimplemented,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for AndroidClipboardError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Unimplemented")
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for AndroidClipboardError {}
|
||||
|
||||
impl ClipboardProvider for Clipboard {
|
||||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
Err(Box::new(AndroidClipboardError::Unimplemented))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue