| Crates.io | influx3_lp |
| lib.rs | influx3_lp |
| version | 0.1.1 |
| created_at | 2025-09-21 12:12:17.871773+00 |
| updated_at | 2025-09-21 12:16:12.600011+00 |
| description | A serializer for Rust structs according to InfluxDB 3 line protocol |
| homepage | https://github.com/yijiecc/influx3_lp |
| repository | https://github.com/yijiecc/influx3_lp |
| max_upload_size | |
| id | 1848780 |
| size | 21,771 |
A serializer for Rust structs according to InfluxDB 3 line protocol.
When writing data to InfluxDB 3 Core, we have to write_lp API which differs from JSON.
This crate defines a derive macro called Influx3Lp to assit write process.
use influx3_lp::Influx3Lp;
#[derive(Influx3Lp)]
#[influx3_lp(table_name = "home")]
struct SensorData {
pub temp: f32,
pub hum: f64,
pub co: Option<i32>,
pub weather: String,
#[influx3_lp(timestamp)]
pub timestamp: i64,
#[influx3_lp(tag)]
pub room: String,
}
let data = SensorData {
temp: 21.0,
hum: 35.9,
co: Some(0),
weather: String::from("sunny"),
timestamp: 1735545600,
room: String::from("Kitchen"),
};
// call `to_lp` function to transform struct to a String
let serialized = data.to_lp();
assert_eq!(serialized,
"home,room=Kitchen temp=21,hum=35.9,co=0i,weather=\"sunny\" 1735545600")
These are features implemented by influx3_lp:
#[influx3_lp(timestamp)] attribute is optional#[influx3_lp(tag)] atrributes are supportedi8,i16,i32,i64 field values are appended with iu8,u16,u32,u64 field values are appended with uOption<T> is supported