pub trait Capture {
type Error;
// Required method
fn capture(&mut self) -> Result<Screenshot, Self::Error>;
}Expand description
A self-contained screenshot source (e.g. a system capture session).
Implemented by providers that already hold everything needed to produce a
screenshot on demand. Driver crates (miniscreenshot-wayland,
miniscreenshot-x11, miniscreenshot-portal, …) implement this trait so
they can be used interchangeably.
A blanket implementation is provided for FnMut() -> Result<Screenshot, E>,
so free functions like miniscreenshot_wgpu::capture(&device, &queue, &texture) can be used as trait objects via a closure:
ⓘ
let mut cap = || miniscreenshot_wgpu::capture(&device, &queue, &texture);
take_and_save(&mut cap);Required Associated Types§
Required Methods§
Sourcefn capture(&mut self) -> Result<Screenshot, Self::Error>
fn capture(&mut self) -> Result<Screenshot, Self::Error>
Capture a screenshot from this source.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".