Skip to content

frofor/zswap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zswap

Async Rust library for querying Zswap information on Linux.

crates.io

Installation

To install the latest version of the crate from crates.io, run:

$ cargo add zswap

Getting started

To 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(())
}

License

This crate is distributed under the terms of MIT License.

See LICENSE for details.

About

Async Rust library for querying Zswap information on Linux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages