Skip to main content

Module async_api

Module async_api 

Source
Available on crate feature async only.
Expand description

Async Vision API — Future-based wrappers for VNImageRequestHandler and friends.

Enable with features = ["async"]. Each wrapper dispatches the synchronous Vision request on a background queue (via DispatchQueue.global) and returns a std::future::Future that resolves when the request completes.

§Tier-2 note

Multi-fire delegates, KVO, and continuous observation streams (e.g. VNVideoProcessor frame-by-frame callbacks, optical-flow streaming) are not included here — they follow a Stream pattern and belong in a future Tier-2 module.

§Example

use apple_vision::async_api::AsyncRecognizeText;
use apple_vision::recognize_text::RecognitionLevel;

let texts = AsyncRecognizeText::new(RecognitionLevel::Accurate, true)
    .recognize_in_path("/path/to/image.png")
    .await?;
for text in &texts {
    println!("{}", text.text);
}

Structs§

AsyncDetectBarcodesdetect_barcodes
Async wrapper for VNDetectBarcodesRequest.
AsyncDetectFacesdetect_faces
Async wrapper for VNDetectFaceRectanglesRequest.
AsyncPersonSegmentationsegmentation
Async wrapper for VNGeneratePersonSegmentationRequest.
AsyncRecognizeTextrecognize_text
Async wrapper for VNRecognizeTextRequest.
DetectBarcodesFuturedetect_barcodes
Future resolving to a Vec<DetectedBarcode>.
DetectFacesFuturedetect_faces
Future resolving to a Vec<DetectedFace>.
PersonSegmentationFuturesegmentation
Future resolving to a SegmentationMask.
RecognizeTextFuturerecognize_text
Future resolving to a Vec<RecognizedText>.