Skip to main content

UseEuvCamera

Struct UseEuvCamera 

Source
pub struct UseEuvCamera {
    pub camera_open: Signal<bool>,
    pub camera_loading: Signal<bool>,
    pub error_message: Signal<String>,
    pub facing: Signal<EuvCameraFacing>,
    pub scan_result: Signal<String>,
    pub scan_handle: Signal<Option<IntervalHandle>>,
}
Expand description

Reactive state for the camera, including camera control, facing mode, and QR code scanning results.

Fields§

§camera_open: Signal<bool>

Whether the camera stream is currently open.

§camera_loading: Signal<bool>

Whether the camera is in the process of opening.

§error_message: Signal<String>

The current error message, empty if no error.

§facing: Signal<EuvCameraFacing>

The current camera facing direction (front or rear).

§scan_result: Signal<String>

The last QR code scan result text.

§scan_handle: Signal<Option<IntervalHandle>>

The interval handle for the periodic QR code scan timer.

Implementations§

Source§

impl UseEuvCamera

Implementation of camera functionality.

Source

pub fn use_camera_state() -> UseEuvCamera

Creates camera state for controlling camera stream and QR scanning.

§Returns
  • UseEuvCamera: The camera state.
Source

pub fn on_close( self, config: Option<&EuvCameraConfig>, ) -> Option<Rc<dyn Fn(Event)>>

Creates a click event handler that closes the camera stream and stops the QR code scan.

§Arguments
  • Option<&EuvCameraConfig>: Optional camera configuration.
§Returns
  • Option<Rc<dyn Fn(Event)>>: A click event handler.
Source

pub fn on_switch( self, config: Option<&EuvCameraConfig>, ) -> Option<Rc<dyn Fn(Event)>>

Creates a click event handler that switches the camera facing direction.

§Arguments
  • Option<&EuvCameraConfig>: Optional camera configuration.
§Returns
  • Option<Rc<dyn Fn(Event)>>: A click event handler.
Source

pub fn on_open( self, config: Option<&EuvCameraConfig>, ) -> Option<Rc<dyn Fn(Event)>>

Creates a click event handler that opens the camera and starts QR scanning.

§Arguments
  • Option<&EuvCameraConfig>: Optional camera configuration.
§Returns
  • Option<Rc<dyn Fn(Event)>>: A click event handler.
Source

pub fn cleanup(self, config: Option<&EuvCameraConfig>)

Registers a cleanup callback that closes the camera stream and stops the QR code scan timer when the component unmounts or the page route switches away.

§Arguments
  • Option<&EuvCameraConfig>: Optional camera configuration.
Source§

impl UseEuvCamera

Source

pub fn get_camera_open(&self) -> &Signal<bool>

Source

pub fn get_mut_camera_open(&mut self) -> &mut Signal<bool>

Source

pub fn set_camera_open(&mut self, val: Signal<bool>) -> &mut Self

Source

pub fn get_camera_loading(&self) -> &Signal<bool>

Source

pub fn get_mut_camera_loading(&mut self) -> &mut Signal<bool>

Source

pub fn set_camera_loading(&mut self, val: Signal<bool>) -> &mut Self

Source

pub fn get_error_message(&self) -> &Signal<String>

Source

pub fn get_mut_error_message(&mut self) -> &mut Signal<String>

Source

pub fn set_error_message(&mut self, val: Signal<String>) -> &mut Self

Source

pub fn get_facing(&self) -> &Signal<EuvCameraFacing>

Source

pub fn get_mut_facing(&mut self) -> &mut Signal<EuvCameraFacing>

Source

pub fn set_facing(&mut self, val: Signal<EuvCameraFacing>) -> &mut Self

Source

pub fn get_scan_result(&self) -> &Signal<String>

Source

pub fn get_mut_scan_result(&mut self) -> &mut Signal<String>

Source

pub fn set_scan_result(&mut self, val: Signal<String>) -> &mut Self

Source

pub fn get_scan_handle(&self) -> &Signal<Option<IntervalHandle>>

Source

pub fn get_mut_scan_handle(&mut self) -> &mut Signal<Option<IntervalHandle>>

Source

pub fn set_scan_handle( &mut self, val: Signal<Option<IntervalHandle>>, ) -> &mut Self

Source§

impl UseEuvCamera

Source

pub fn new( camera_open: Signal<bool>, camera_loading: Signal<bool>, error_message: Signal<String>, facing: Signal<EuvCameraFacing>, scan_result: Signal<String>, scan_handle: Signal<Option<IntervalHandle>>, ) -> Self

Trait Implementations§

Source§

impl Clone for UseEuvCamera

Source§

fn clone(&self) -> UseEuvCamera

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UseEuvCamera

Source§

impl Debug for UseEuvCamera

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for UseEuvCamera

Source§

impl PartialEq for UseEuvCamera

Source§

fn eq(&self, other: &UseEuvCamera) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for UseEuvCamera

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more