Made R701 shareable via an internal Mutex, allowing get_name to be called while streaming records
Check, format and test / build (push) Successful in 34s
Check, format and test / build (push) Successful in 34s
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,18 +38,13 @@ If you want to read about this reverse engineering attempt, check out
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let mut r701 = R701::connect("127.0.0.1:5005").await.unwrap();
|
||||
|
||||
let records = r701
|
||||
.into_record_iter()
|
||||
.await
|
||||
.unwrap()
|
||||
.collect::<Vec<_>>()
|
||||
.await;
|
||||
let r701 = R701::connect("127.0.0.1:5005").await.unwrap();
|
||||
let mut record_stream = r701.into_record_iter().await.unwrap();
|
||||
let mut id = 0;
|
||||
|
||||
println!("No\tMchn\tEnNo\t\tName\t\tMode\tIOMd\tDateTime\t");
|
||||
for (id, record) in records.iter().rev().enumerate() {
|
||||
let record = record.as_ref().unwrap();
|
||||
while let Some(record) = record_stream.next().await {
|
||||
let record = record.unwrap();
|
||||
let name = r701
|
||||
.get_name(record.employee_id)
|
||||
.await
|
||||
@@ -66,6 +61,8 @@ If you want to read about this reverse engineering attempt, check out
|
||||
record.clock as u8,
|
||||
record.datetime.format("%Y/%m/%d %H:%M:%S"),
|
||||
);
|
||||
|
||||
id += 1;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user