Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions src/platform/dummy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
use std::{
borrow::Cow,
marker::PhantomData,
path::{Path, PathBuf},
};

use crate::common::Error;
#[cfg(feature = "image-data")]
use crate::ImageData;

pub(crate) struct Clipboard;

impl Clipboard {
pub(crate) fn new() -> Result<Self, Error> {
Err(Error::ClipboardNotSupported)
}
}

pub(crate) struct Clear<'a> {
_p: PhantomData<&'a ()>,
}

impl<'a> Clear<'a> {
pub(crate) fn new(_clipboard: &'a mut Clipboard) -> Self {
Self { _p: PhantomData }
}

pub(crate) fn clear(self) -> Result<(), Error> {
Err(Error::ClipboardNotSupported)
}
}

pub(crate) struct Set<'a> {
_p: PhantomData<&'a ()>,
}

impl<'a> Set<'a> {
pub(crate) fn new(_clipboard: &'a mut Clipboard) -> Self {
Self { _p: PhantomData }
}

pub(crate) fn text(self, _text: Cow<'_, str>) -> Result<(), Error> {
Err(Error::ClipboardNotSupported)
}

pub(crate) fn html(self, _html: Cow<'_, str>, _alt: Option<Cow<'_, str>>) -> Result<(), Error> {
Err(Error::ClipboardNotSupported)
}

#[cfg(feature = "image-data")]
pub(crate) fn image(self, _image: ImageData<'_>) -> Result<(), Error> {
Err(Error::ClipboardNotSupported)
}

pub(crate) fn file_list(self, _file_list: &[impl AsRef<Path>]) -> Result<(), Error> {
Err(Error::ClipboardNotSupported)
}
}

pub(crate) struct Get<'a> {
_p: PhantomData<&'a ()>,
}

impl<'a> Get<'a> {
pub(crate) fn new(_clipboard: &'a mut Clipboard) -> Self {
Self { _p: PhantomData }
}

pub(crate) fn text(self) -> Result<String, Error> {
Err(Error::ContentNotAvailable)
}

#[cfg(feature = "image-data")]
pub(crate) fn image(self) -> Result<ImageData<'static>, Error> {
Err(Error::ContentNotAvailable)
}

pub(crate) fn html(self) -> Result<String, Error> {
Err(Error::ContentNotAvailable)
}

pub(crate) fn file_list(self) -> Result<Vec<PathBuf>, Error> {
Err(Error::ContentNotAvailable)
}
}
6 changes: 6 additions & 0 deletions src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ pub use windows::*;
mod osx;
#[cfg(target_os = "macos")]
pub use osx::*;

#[cfg(target_os = "android")]
mod dummy;

#[cfg(target_os = "android")]
pub(crate) use dummy::*;