libraries can now work threaded if they wish (see http_requests). This means that multiple functions provided by one library can run at the same time (using thread(), see http.mers) and actually do the work they need to do simultaneously.

This commit is contained in:
mark
2023-05-09 22:11:13 +02:00
parent 9b92c5b353
commit a7bb3e67fa
13 changed files with 1127 additions and 518 deletions

34
mers/tests/lib_comms.rs Normal file
View File

@@ -0,0 +1,34 @@
use std::io::Cursor;
use mers_libs::prelude::*;
use mers_libs::{ByteData, ByteDataA};
#[test]
fn list_type() {
let a: Vec<i32> = vec![14, 26];
let bytes = a.as_byte_data_vec();
println!("{bytes:?}");
assert_eq!(
Vec::<i32>::from_byte_data(&mut Cursor::new(bytes)).unwrap(),
a
);
let a = VSingleType::List(VSingleType::Int.to()).to();
assert_eq!(
VType::from_byte_data(&mut Cursor::new(a.as_byte_data_vec())).unwrap(),
a
);
let a = VSingleType::Tuple(vec![
VType {
types: vec![VSingleType::Tuple(vec![]), VSingleType::Int],
},
VSingleType::String.to(),
VSingleType::EnumVariant(12, VSingleType::Float.to()).to(),
])
.to();
assert_eq!(
VType::from_byte_data(&mut Cursor::new(a.as_byte_data_vec())).unwrap(),
a
);
}