[][src]Function nitrokey::connect_model

pub fn connect_model(model: Model) -> Result<DeviceWrapper, CommandError>

Connects to a Nitrokey device of the given model.

Errors

  • Undefined if no Nitrokey device of the given model is connected

Example

use nitrokey::DeviceWrapper;
use nitrokey::Model;

fn do_something(device: DeviceWrapper) {}

match nitrokey::connect_model(Model::Pro) {
    Ok(device) => do_something(device),
    Err(err) => println!("Could not connect to a Nitrokey Pro: {}", err),
}