Struct libfprint_rs::FpContext
source · pub struct FpContext { /* private fields */ }
Expand description
This struct allows you to discover fingerprint scanning hardware. This is the starting point when integrating libfprint-rs into your software.
Implementations§
source§impl FpContext
impl FpContext
sourcepub fn new() -> FpContext
pub fn new() -> FpContext
Examples found in repository?
examples/verify.rs (line 6)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main() {
let context = FpContext::new();
let devices = context.get_devices();
let dev = match devices.iter().next() {
Some(dev) => dev,
None => {
eprintln!("No devices detected.");
std::process::exit(1);
}
};
let print_matched = verify(dev).unwrap();
if print_matched {
println!("Print matched");
} else {
println!("Prints don't match!!");
}
}
More examples
examples/enroll.rs (line 4)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() {
let context = FpContext::new();
let devices = context.get_devices();
let dev = match devices.iter().next() {
Some(dev) => dev,
None => {
eprintln!("No devices detected.");
std::process::exit(1);
}
};
let print = enroll(dev);
if let Ok(print) = print {
let username = print.get_username().unwrap();
println!("User provided username: \"{}\"", username);
}
}
sourcepub fn enumerate(&self)
pub fn enumerate(&self)
Enumerate all the devices connected to the system
This function will enumerate all the devices connected to the system and add them to the context.
sourcepub fn get_devices<'a>(&'a self) -> DeviceList<'a>
pub fn get_devices<'a>(&'a self) -> DeviceList<'a>
Get the list of devices connected to the system
Examples:
use libfprint_rs::FpContext;
let context = FpContext::new();
let devices = context.get_devices();
Examples found in repository?
examples/verify.rs (line 7)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main() {
let context = FpContext::new();
let devices = context.get_devices();
let dev = match devices.iter().next() {
Some(dev) => dev,
None => {
eprintln!("No devices detected.");
std::process::exit(1);
}
};
let print_matched = verify(dev).unwrap();
if print_matched {
println!("Print matched");
} else {
println!("Prints don't match!!");
}
}
More examples
examples/enroll.rs (line 5)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() {
let context = FpContext::new();
let devices = context.get_devices();
let dev = match devices.iter().next() {
Some(dev) => dev,
None => {
eprintln!("No devices detected.");
std::process::exit(1);
}
};
let print = enroll(dev);
if let Ok(print) = print {
let username = print.get_username().unwrap();
println!("User provided username: \"{}\"", username);
}
}
Auto Trait Implementations§
impl RefUnwindSafe for FpContext
impl !Send for FpContext
impl !Sync for FpContext
impl Unpin for FpContext
impl UnwindSafe for FpContext
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