Skip to main content

DeviceFeature

Struct DeviceFeature 

Source
pub struct DeviceFeature(/* private fields */);
Expand description

Capability bit-flags, matching libfprint’s FpDeviceFeature (fp-device.h).

The bit positions are load-bearing: IDENTIFY = 1<<1 and VERIFY = 1<<2 (note the order is not alphabetical in libfprint). STORAGE distinguishes match-on-chip (MOC) devices — which keep templates on the sensor — from host-side-storage devices.

Hand-rolled (no bitflags dependency) to keep fprint-core allocation- and dependency-free.

Implementations§

Source§

impl DeviceFeature

Source

pub const NONE: DeviceFeature

The empty set (FP_DEVICE_FEATURE_NONE). Every set contains it.

Source

pub const CAPTURE: DeviceFeature

FP_DEVICE_FEATURE_CAPTURE: the device can return a raw image (fp_device_capture). Image sensors have it; match-on-chip sensors normally do not.

Source

pub const IDENTIFY: DeviceFeature

FP_DEVICE_FEATURE_IDENTIFY: the device can match one scan against a gallery (Device::identify).

Source

pub const VERIFY: DeviceFeature

FP_DEVICE_FEATURE_VERIFY: the device can match one scan against one print (Device::verify).

Source

pub const STORAGE: DeviceFeature

FP_DEVICE_FEATURE_STORAGE: the device keeps templates on the sensor, which marks it match-on-chip — see DeviceFeature::is_match_on_chip.

Source

pub const STORAGE_LIST: DeviceFeature

FP_DEVICE_FEATURE_STORAGE_LIST: on-sensor storage can be enumerated (Device::list_prints).

Source

pub const STORAGE_DELETE: DeviceFeature

FP_DEVICE_FEATURE_STORAGE_DELETE: a single template can be removed from on-sensor storage (Device::delete_print).

Source

pub const STORAGE_CLEAR: DeviceFeature

FP_DEVICE_FEATURE_STORAGE_CLEAR: on-sensor storage can be erased wholesale (Device::clear_storage).

Source

pub const DUPLICATES_CHECK: DeviceFeature

FP_DEVICE_FEATURE_DUPLICATES_CHECK: the device rejects enrolling a finger it already holds, reporting Error::DataDuplicate.

Source

pub const ALWAYS_ON: DeviceFeature

FP_DEVICE_FEATURE_ALWAYS_ON: the sensor runs continuously rather than being powered up per operation.

Source

pub const UPDATE_PRINT: DeviceFeature

FP_DEVICE_FEATURE_UPDATE_PRINT: enrolling can extend an existing template with new scans instead of replacing it.

Source

pub const fn bits(self) -> u16

Raw bitmask (as returned by fp_device_get_features).

Source

pub const fn from_bits_truncate(bits: u32) -> DeviceFeature

Build from a raw bitmask, keeping only defined bits.

Takes a u32 (libfprint’s FpDeviceFeature is a 32-bit flags type) and masks to the defined 0..=9 bits here, so callers never narrow before masking.

Source

pub const fn contains(self, other: DeviceFeature) -> bool

fp_device_has_feature: true iff every bit in other is set in self.

Source

pub const fn is_empty(self) -> bool

Whether no flag is set (equal to DeviceFeature::NONE).

Source

pub const fn intersects(self, other: DeviceFeature) -> bool

Whether self and other share any flag.

Source

pub const fn is_match_on_chip(self) -> bool

Whether this looks like a match-on-chip device (persistent on-sensor storage).

Trait Implementations§

Source§

impl BitAnd for DeviceFeature

Source§

fn bitand(self, rhs: DeviceFeature) -> DeviceFeature

Set intersection: the flags in both sets.

Source§

type Output = DeviceFeature

The resulting type after applying the & operator.
Source§

impl BitAndAssign for DeviceFeature

Source§

fn bitand_assign(&mut self, rhs: DeviceFeature)

Performs the &= operation. Read more
Source§

impl BitOr for DeviceFeature

Source§

type Output = DeviceFeature

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: DeviceFeature) -> DeviceFeature

Performs the | operation. Read more
Source§

impl BitOrAssign for DeviceFeature

Source§

fn bitor_assign(&mut self, rhs: DeviceFeature)

Performs the |= operation. Read more
Source§

impl Clone for DeviceFeature

Source§

fn clone(&self) -> Self

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 DeviceFeature

Source§

impl Debug for DeviceFeature

Source§

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

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

impl Default for DeviceFeature

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DeviceFeature

Source§

impl Not for DeviceFeature

Source§

fn not(self) -> DeviceFeature

Set complement within the defined flags — unknown/high bits never appear, so !!x == x for every representable set.

Source§

type Output = DeviceFeature

The resulting type after applying the ! operator.
Source§

impl PartialEq for DeviceFeature

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DeviceFeature

Source§

impl Sub for DeviceFeature

Source§

fn sub(self, rhs: DeviceFeature) -> DeviceFeature

Set difference: the flags in self that are not in rhs (self & !rhs).

Source§

type Output = DeviceFeature

The resulting type after applying the - operator.
Source§

impl SubAssign for DeviceFeature

Source§

fn sub_assign(&mut self, rhs: DeviceFeature)

Performs the -= operation. 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.