Async Rust library for querying Zswap information on Linux.
To install the latest version of the crate from crates.io, run:
$ cargo add zswapTo get started, create a new program that prints Zswap usage information:
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let enabled = zswap::param::enabled().await?;
if !enabled {
eprintln!("Zswap is not enabled");
return Ok(());
}
let compressed = zswap::compressed().await?;
let uncompressed = zswap::uncompressed().await?;
let ratio = zswap::ratio().await?;
println!("Compressed size: {compressed} B");
println!("Uncompressed size: {uncompressed} B");
println!("Compression ratio: {ratio}");
Ok(())
}This crate is distributed under the terms of MIT License.
See LICENSE for details.