pub enum CameraState {
Idle,
Starting,
Running {
device: String,
},
Stopped,
Failed(CameraError),
}Expand description
What the camera session is doing.
Variants§
Idle
Nothing has been asked of it.
Starting
A session is opening. Phones take a noticeable moment over this, which is why it is a state a screen can show rather than a gap before frames.
Running
Frames are being produced.
Stopped
The session was stopped and the device released.
Failed(CameraError)
The session could not start, or ended on its own.
Implementations§
Source§impl CameraState
impl CameraState
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether frames are being produced now.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Whether the session is opening or open — which is when a screen keeps the viewfinder on screen rather than showing a placeholder.
Sourcepub fn failure(&self) -> Option<&CameraError>
pub fn failure(&self) -> Option<&CameraError>
The failure, if the session ended in one.
Trait Implementations§
Source§impl Clone for CameraState
impl Clone for CameraState
Source§impl Debug for CameraState
impl Debug for CameraState
Source§impl Default for CameraState
impl Default for CameraState
impl Eq for CameraState
Source§impl PartialEq for CameraState
impl PartialEq for CameraState
impl StructuralPartialEq for CameraState
Auto Trait Implementations§
impl Freeze for CameraState
impl RefUnwindSafe for CameraState
impl Send for CameraState
impl Sync for CameraState
impl Unpin for CameraState
impl UnsafeUnpin for CameraState
impl UnwindSafe for CameraState
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