pub trait ClipboardProvider {
// Required methods
fn get_text(&mut self) -> Option<String>;
fn set_text(&mut self, text: &str) -> bool;
// Provided methods
fn get_html(&mut self) -> Option<String> { ... }
fn set_html(&mut self, _html: &str, _alt_text: Option<&str>) -> bool { ... }
fn get_image(&mut self) -> Option<ClipboardImage> { ... }
fn set_image(&mut self, _image: &ClipboardImage) -> bool { ... }
fn get_file_list(&mut self) -> Option<Vec<PathBuf>> { ... }
fn set_file_list(&mut self, _paths: &[PathBuf]) -> bool { ... }
}Expand description
剪贴板抽象 trait。core 层不依赖任何第三方剪贴板 crate。
组件只需要纯文本;富剪贴板(HTML/图片/文件列表)由应用层通过默认方法使用, 平台不支持时保持 None/false。
Required Methods§
Provided Methods§
Sourcefn set_html(&mut self, _html: &str, _alt_text: Option<&str>) -> bool
fn set_html(&mut self, _html: &str, _alt_text: Option<&str>) -> bool
写入 HTML 与可选纯文本 alternative。
fn get_image(&mut self) -> Option<ClipboardImage>
fn set_image(&mut self, _image: &ClipboardImage) -> bool
fn get_file_list(&mut self) -> Option<Vec<PathBuf>>
fn set_file_list(&mut self, _paths: &[PathBuf]) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".