refactor: clean comments and docstring

This commit is contained in:
2024-08-02 22:58:32 +02:00
parent e9ef6cbb4b
commit 723c06acd9
5 changed files with 38 additions and 52 deletions

View File

@ -1,16 +1,11 @@
/// High level API for the SSV library,
/// based on the low level bindings in libssv.rs.
extern crate dotenv;
use libc::{c_void, size_t};
/**
* High level API for the SSV library,
* based on the low level bindings in libssv.rs.
*
*/
use std::path::PathBuf;
use std::ffi::CString;
use std::ptr;
use std::env;
use std::ffi::CString;
use std::path::PathBuf;
use std::ptr;
use crate::cps::lire_carte;
use crate::libssv::{SSV_InitLIB2, SSV_LireConfig};
@ -44,17 +39,16 @@ fn ssv_lire_config() {
}
pub fn demo() {
/*
* TODO : this is probably not working on release, because I'm not sure it exists a CARGO_MANIFEST_DIR and so it can find the `.env`
* Maybe we could use a system standard config path to store a config file
*/
// TODO : this is probably not working on release, because I'm not sure it exists a CARGO_MANIFEST_DIR and so it can find the `.env`
// Maybe we could use a system standard config path to store a config file
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let manifest_path = PathBuf::from(manifest_dir);
dotenv::from_path(manifest_path.join(".env")).ok();
println!("------- Demo for the SSV library 2 --------");
println!("------- Demo for the SSV library --------");
ssv_init_lib_2();
let code_pin = "1234";
let lecteur = "HID Global OMNIKEY 3x21 Smart Card Reader 0";
let carte_ps = lire_carte(code_pin, lecteur);