1 unstable release
0.2.0 | Dec 18, 2024 |
---|
#367 in Embedded development
111 downloads per month
25KB
544 lines
ndef
#![no_std]
Rust library to manipulate NDEF.
Features
- alloc: enable a global allocator
- allow more than 8 records per message
- allow more than 256 bytes of payload size
- allow to decode UTF-16 RTD Text record (always encoded in UTF-8)
- allow to encode RTD external record
- cbor: add minicbor dependency
- provide a custom cbor RTD external record
- provide a convenient record payload from cbor encodable type (need
alloc
too)
Example Usage
Cargo.toml
[dependencies]
ndef = "0.1.0"
main.rs
use ndef::{Message, Payload, Record, RecordType};
fn main() {
let mut msg = Message::default();
let mut rec1 = Record::new(
None,
Payload::RTD(RecordType::Text {
enc: "en",
txt: "NDEF Text from Rust🦀!",
}),
);
msg.append_record(&mut rec1).unwrap();
// Print message raw data
println!("message raw data: {:?}", msg.to_vec().unwrap().as_slice());
}
Dependencies
~0.3–1MB
~21K SLoC