pub struct LiveTextInteractionTypes(/* private fields */);Implementations§
Source§impl LiveTextInteractionTypes
impl LiveTextInteractionTypes
pub const NONE: Self
pub const AUTOMATIC: Self
pub const TEXT_SELECTION: Self
pub const DATA_DETECTORS: Self
pub const IMAGE_SUBJECT: Self
pub const VISUAL_LOOK_UP: Self
pub const AUTOMATIC_TEXT_ONLY: Self
pub const fn new(raw: u64) -> Self
Sourcepub const fn bits(self) -> u64
pub const fn bits(self) -> u64
Examples found in repository?
examples/02_framework_smoke.rs (line 57)
12fn main() -> Result<(), Box<dyn std::error::Error>> {
13 println!("== VisionKit.framework smoke ==");
14 println!("ImageAnalyzer supported: {}", ImageAnalyzer::is_supported());
15 println!(
16 "document camera available on macOS: {}",
17 VNDocumentCameraViewController::is_available_on_current_platform()?
18 );
19 println!(
20 "data scanner available on macOS: {}",
21 DataScannerViewController::is_available_on_current_platform()?
22 );
23
24 let languages = ImageAnalyzer::supported_text_recognition_languages()?;
25 println!("supported OCR languages: {}", languages.len());
26 println!(
27 "sample OCR languages: {:?}",
28 languages.iter().take(10).collect::<Vec<_>>()
29 );
30
31 if !ImageAnalyzer::is_supported() {
32 println!("ImageAnalyzer is not supported on this Mac");
33 return Ok(());
34 }
35
36 let analyzer = ImageAnalyzer::new()?;
37 let configuration = ImageAnalyzerConfiguration::new(
38 ImageAnalysisTypes::TEXT | ImageAnalysisTypes::MACHINE_READABLE_CODE,
39 )
40 .with_locales(["en-US"]);
41 let asset_path = asset_path();
42 let analysis =
43 analyzer.analyze_image_at_path(&asset_path, ImageOrientation::Up, &configuration)?;
44
45 println!(
46 "has text results: {}",
47 analysis.has_results(ImageAnalysisTypes::TEXT)?
48 );
49 let transcript = analysis.transcript()?;
50 println!("transcript: {transcript:?}");
51
52 let interaction = LiveTextInteraction::new()?;
53 interaction.track_image_at_path(&asset_path)?;
54 interaction.set_analysis(&analysis)?;
55 println!(
56 "overlay preferred types: {}",
57 interaction.preferred_interaction_types()?.bits()
58 );
59 let overlay_text = interaction.text();
60 println!("overlay text: {overlay_text:?}");
61 Ok(())
62}pub const fn contains(self, other: Self) -> bool
Trait Implementations§
Source§impl BitOr for LiveTextInteractionTypes
impl BitOr for LiveTextInteractionTypes
Source§impl BitOrAssign for LiveTextInteractionTypes
impl BitOrAssign for LiveTextInteractionTypes
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl Clone for LiveTextInteractionTypes
impl Clone for LiveTextInteractionTypes
Source§fn clone(&self) -> LiveTextInteractionTypes
fn clone(&self) -> LiveTextInteractionTypes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LiveTextInteractionTypes
impl Debug for LiveTextInteractionTypes
Source§impl Default for LiveTextInteractionTypes
impl Default for LiveTextInteractionTypes
Source§impl Hash for LiveTextInteractionTypes
impl Hash for LiveTextInteractionTypes
Source§impl PartialEq for LiveTextInteractionTypes
impl PartialEq for LiveTextInteractionTypes
Source§fn eq(&self, other: &LiveTextInteractionTypes) -> bool
fn eq(&self, other: &LiveTextInteractionTypes) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for LiveTextInteractionTypes
impl Eq for LiveTextInteractionTypes
impl StructuralPartialEq for LiveTextInteractionTypes
Auto Trait Implementations§
impl Freeze for LiveTextInteractionTypes
impl RefUnwindSafe for LiveTextInteractionTypes
impl Send for LiveTextInteractionTypes
impl Sync for LiveTextInteractionTypes
impl Unpin for LiveTextInteractionTypes
impl UnsafeUnpin for LiveTextInteractionTypes
impl UnwindSafe for LiveTextInteractionTypes
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