pub struct AsyncSCScreenshotManager;Expand description
Async wrapper for SCScreenshotManager
Provides async methods for single-frame screenshot capture. Executor-agnostic - works with any async runtime.
Requires the macos_14_0 feature flag.
§Examples
use screencapturekit::async_api::{AsyncSCShareableContent, AsyncSCScreenshotManager};
use screencapturekit::stream::configuration::SCStreamConfiguration;
use screencapturekit::stream::content_filter::SCContentFilter;
let content = AsyncSCShareableContent::get().await?;
let display = &content.displays()[0];
let filter = SCContentFilter::builder().display(display).exclude_windows(&[]).build();
let mut config = SCStreamConfiguration::default();
config.set_width(1920);
config.set_height(1080);
let image = AsyncSCScreenshotManager::capture_image(&filter, &config).await?;
println!("Screenshot: {}x{}", image.width(), image.height());Implementations§
Source§impl AsyncSCScreenshotManager
impl AsyncSCScreenshotManager
Sourcepub fn capture_image(
content_filter: &SCContentFilter,
configuration: &SCStreamConfiguration,
) -> AsyncScreenshotFuture<CGImage> ⓘ
pub fn capture_image( content_filter: &SCContentFilter, configuration: &SCStreamConfiguration, ) -> AsyncScreenshotFuture<CGImage> ⓘ
Capture a single screenshot as a CGImage asynchronously
§Errors
Returns an error if:
- Screen recording permission is not granted
- The capture fails for any reason
Sourcepub fn capture_sample_buffer(
content_filter: &SCContentFilter,
configuration: &SCStreamConfiguration,
) -> AsyncScreenshotFuture<CMSampleBuffer> ⓘ
pub fn capture_sample_buffer( content_filter: &SCContentFilter, configuration: &SCStreamConfiguration, ) -> AsyncScreenshotFuture<CMSampleBuffer> ⓘ
Capture a single screenshot as a CMSampleBuffer asynchronously
§Errors
Returns an error if:
- Screen recording permission is not granted
- The capture fails for any reason
Auto Trait Implementations§
impl Freeze for AsyncSCScreenshotManager
impl RefUnwindSafe for AsyncSCScreenshotManager
impl Send for AsyncSCScreenshotManager
impl Sync for AsyncSCScreenshotManager
impl Unpin for AsyncSCScreenshotManager
impl UnwindSafe for AsyncSCScreenshotManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more