Crates.io | frclib-datalog |
lib.rs | frclib-datalog |
version | 0.1.3 |
source | src |
created_at | 2024-08-24 05:31:12.023856 |
updated_at | 2024-08-24 05:31:12.023856 |
description | An implementation of WPI's DataLog spec |
homepage | |
repository | https://github.com/oh-yes-0-fps/frclib-datalog |
max_upload_size | |
id | 1349822 |
size | 18,212,826 |
the specs can be found here
use std::{path::PathBuf, fs:File};
use frclib_datalog::DataLogWriter;
use frclib_core::value::FrcValue;
let path = PathBuf::from("path/to/file");
let reader = DataLogWriter::try_new(File::create(path).unwrap(), Default::default())
.expect("Failed to create writer");
let entry = writer.get_entry::<i32>("test", None).expect("Failed to get entry");
writer.write_timestamped(entry, 10, now() - 5).expect("Failed to write entry");
writer.write_timestamped(entry, 20, now() + 20).expect("Failed to write entry");
writer.write_timestamped(entry, 30, now() + 50).expect("Failed to write entry");
use std::{path::PathBuf, fs:File};
use frclib_datalog::DataLogReader;
use frclib_core::value::FrcValue;
let path = PathBuf::from("path/to/file");
let reader = DataLogReader::try_new(File::open(path).unwrap(), Default::default())
.expect("Failed to create reader");
reader.read_entry("entry_name").into_iter().for_each(|value| {
match value.value {
FrcValue::Int(i) => println!("Int: {}", i),
_ => println!("Not an int")
}
});
Haven't setup anything formal yet but on my maching (r7 5800x mobile) it reads and decodes a 103mb file in 0.7s and a 17mb file in 0.11s