Skip to main content

LiveTextSubject

Struct LiveTextSubject 

Source
pub struct LiveTextSubject { /* private fields */ }

Implementations§

Source§

impl LiveTextSubject

Source

pub fn bounds(&self) -> Result<Rect, VisionKitError>

Examples found in repository?
examples/05_live_text_interaction.rs (line 88)
69fn print_subject_state(
70    interaction: &LiveTextInteraction,
71) -> Result<(), Box<dyn std::error::Error>> {
72    println!(
73        "subject unavailable case: {:?}",
74        LiveTextSubjectUnavailable::ImageUnavailable
75    );
76    match interaction.begin_subject_analysis_if_necessary() {
77        Ok(()) => println!("subject analysis started"),
78        Err(error) => println!("subject analysis started: {error}"),
79    }
80    match interaction.subjects() {
81        Ok(subjects) => {
82            println!("subjects: {}", subjects.len());
83            println!(
84                "highlighted subjects: {}",
85                interaction.highlighted_subjects()?.len()
86            );
87            if let Some(subject) = subjects.first() {
88                println!("subject bounds: {:?}", subject.bounds()?);
89            }
90            match interaction.image_for_subjects(&subjects) {
91                Ok(image) => println!("subject image bytes: {}", image.png_data.len()),
92                Err(error) => println!("subject image bytes: {error}"),
93            }
94        }
95        Err(error) => println!("subjects: {error}"),
96    }
97    Ok(())
98}
Source

pub fn image(&self) -> Result<LiveTextImageData, VisionKitError>

Trait Implementations§

Source§

impl Drop for LiveTextSubject

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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.