MCPcopy Create free account
hub / github.com/dermesser/integer-encoding-rs / read_and_verify_varints

Function read_and_verify_varints

examples/read_write_file.rs:23–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21}
22
23async fn read_and_verify_varints() -> io::Result<()> {
24 let f = tokio::fs::File::open("/tmp/varintbytes").await?;
25 let mut f = tokio::io::BufReader::new(f);
26 let i1: u32 = f.read_varint_async().await?;
27 let i2: u32 = f.read_varint_async().await?;
28 let i3: u32 = f.read_varint_async().await?;
29 let i4: u32 = f.read_varint_async().await?;
30 assert!(f.read_varint_async::<u32>().await.is_err());
31 println!("{:?}", (i1, i2, i3, i4));
32 assert!(i2 == 2 * i1 && i3 == 3 * i1);
33 Ok(())
34}
35
36async fn read_and_verify_fixedints() -> io::Result<()> {
37 let f = tokio::fs::File::open("/tmp/fixedintbytes").await?;

Callers 1

mainFunction · 0.85

Calls 1

read_varint_asyncMethod · 0.80

Tested by

no test coverage detected