12 releases

Uses old Rust 2015

0.1.11 Oct 15, 2016
0.1.10 Jun 20, 2016
0.1.0 May 29, 2016

#1011 in Hardware support

Download history 8/week @ 2023-12-03 109/week @ 2024-02-18 55/week @ 2024-02-25 13/week @ 2024-03-03 5/week @ 2024-03-10

182 downloads per month
Used in nfc-oath

MIT license

35KB
569 lines

nfc

Crates.io

Rust bindings for the libnfc library.

For raw FFI bindings for libnfc, see nfc-sys.

Installation

Install libnfc (e.g. Debian/Ubuntu, brew install libnfc using Homebrew on Mac OSx, or on other systems).

Cargo.toml

[dependencies]
libc = "0.2.0"
nfc = "0.1.11"

Example Usage

// main.rs

extern crate nfc;

use nfc::context;
use nfc::misc;

fn main() {
    let mut context = context::new();

    if context.is_null() {
        println!("Unable to initialize new NFC context!");
    }

    // Initialize libnfc
    nfc::init(&mut context);
    
    // Print libnfc version
    println!("libnfc version: {}", misc::version());
}

TODO

  • Replace any raw pointers
  • Documentation + more in-depth examples

Contributing

I'm brand new to Rust so any help or constructive information would be really appreciated. Thanks in advance!

License

MIT

Dependencies

~65KB