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

Function write_test_files

examples/read_write_file.rs:6–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4use integer_encoding::*;
5
6async fn write_test_files() -> io::Result<()> {
7 let _ = fs::remove_file("/tmp/varintbytes");
8 let mut f = tokio::fs::File::create("/tmp/varintbytes").await?;
9 f.write_varint_async(30 as u32).await?;
10 f.write_varint_async(60 as u32).await?;
11 f.write_varint_async(90 as u32).await?;
12 f.write_varint_async(9000000 as u32).await?;
13
14 let _ = fs::remove_file("/tmp/fixedintbytes");
15 let mut f = tokio::fs::File::create("/tmp/fixedintbytes").await?;
16 f.write_fixedint_async(30 as u32).await?;
17 f.write_fixedint_async(60 as u32).await?;
18 f.write_fixedint_async(90 as u32).await?;
19 f.write_fixedint_async(9000000 as u32).await?;
20 Ok(())
21}
22
23async fn read_and_verify_varints() -> io::Result<()> {
24 let f = tokio::fs::File::open("/tmp/varintbytes").await?;

Callers 1

mainFunction · 0.85

Calls 2

write_varint_asyncMethod · 0.80
write_fixedint_asyncMethod · 0.80

Tested by

no test coverage detected