Enum nokhwa::utils::CameraIndex
source · pub enum CameraIndex {
Index(u32),
String(String),
}
Expand description
Describes the index of the camera.
- Index: A numbered index
- String: A string, used for
IPCameras
.
Variants§
Implementations§
source§impl CameraIndex
impl CameraIndex
sourcepub fn as_index(&self) -> Result<u32, NokhwaError>
pub fn as_index(&self) -> Result<u32, NokhwaError>
Turns this value into a number. If it is a string, it will attempt to parse it as a u32
.
Errors
Fails if the value is not a number.
sourcepub fn as_string(&self) -> String
pub fn as_string(&self) -> String
Turns this value into a String
. If it is a number, it will be automatically converted.
sourcepub fn is_index(&self) -> bool
pub fn is_index(&self) -> bool
Returns true if this CameraIndex
contains an CameraIndex::Index
sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if this CameraIndex
contains an CameraIndex::String
Trait Implementations§
source§impl Clone for CameraIndex
impl Clone for CameraIndex
source§fn clone(&self) -> CameraIndex
fn clone(&self) -> CameraIndex
Returns a copy of the value. Read more
1.0.0 · 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 CameraIndex
impl Debug for CameraIndex
source§impl Default for CameraIndex
impl Default for CameraIndex
source§fn default() -> CameraIndex
fn default() -> CameraIndex
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for CameraIndex
impl<'de> Deserialize<'de> for CameraIndex
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<CameraIndex, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<CameraIndex, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for CameraIndex
impl Display for CameraIndex
source§impl Hash for CameraIndex
impl Hash for CameraIndex
source§impl Ord for CameraIndex
impl Ord for CameraIndex
source§fn cmp(&self, other: &CameraIndex) -> Ordering
fn cmp(&self, other: &CameraIndex) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<CameraIndex> for CameraIndex
impl PartialEq<CameraIndex> for CameraIndex
source§fn eq(&self, other: &CameraIndex) -> bool
fn eq(&self, other: &CameraIndex) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CameraIndex> for CameraIndex
impl PartialOrd<CameraIndex> for CameraIndex
source§fn partial_cmp(&self, other: &CameraIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &CameraIndex) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for CameraIndex
impl Serialize for CameraIndex
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for CameraIndex
impl StructuralEq for CameraIndex
impl StructuralPartialEq for CameraIndex
Auto Trait Implementations§
impl RefUnwindSafe for CameraIndex
impl Send for CameraIndex
impl Sync for CameraIndex
impl Unpin for CameraIndex
impl UnwindSafe for CameraIndex
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.