Skip to main content

AsyncOverlaySubjects

Struct AsyncOverlaySubjects 

Source
pub struct AsyncOverlaySubjects { /* private fields */ }
Available on crate feature async only.
Expand description

True-async entry point for ImageAnalysisOverlayView.subjects and ImageAnalysisOverlayView.subject(at:) (macOS).

On macOS the subject APIs live on ImageAnalysisOverlayView (Rust: LiveTextInteraction), not directly on ImageAnalysis. Both require macOS 13+ and the crate::ImageAnalysisTypes::VISUAL_LOOK_UP analysis type in the configuration used when the analysis was performed.

§Note on subject bounds coordinate space

Bounds are in the same coordinate space that VisionKit uses when populating the overlay view. That is, they are relative to the view’s bounds as configured via setPreferredInteractionTypes and setAnalysis(_:).

Implementations§

Source§

impl AsyncOverlaySubjects

Source

pub fn new(interaction: &LiveTextInteraction) -> Self

Wrap a LiveTextInteraction for async subject queries.

The interaction must remain alive for as long as the returned futures are pending.

Source

pub fn subjects(&self) -> SubjectsFuture

Asynchronously retrieve all subjects as their bounds rectangles.

Internally calls await overlayView.subjects on the Swift side (requires @MainActor). Each subject’s bounds is accessed synchronously within that actor context.

Returns an empty Vec when no subjects are found or when the analysis did not include crate::ImageAnalysisTypes::VISUAL_LOOK_UP.

Source

pub fn subject_at(&self, x: f64, y: f64) -> SubjectAtFuture

Asynchronously find the subject at the given overlay-coordinate point.

Returns Ok(None) when no subject is present at (x, y).

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.