Crates.io | agram |
lib.rs | agram |
version | 1.0.1 |
source | src |
created_at | 2022-02-18 18:39:46.301246 |
updated_at | 2022-02-18 19:37:17.89098 |
description | An offline anagram library |
homepage | |
repository | https://github.com/grantshandy/agram |
max_upload_size | |
id | 534826 |
size | 4,871,131 |
An anagram library for Rust.
Add to your Cargo.toml:
agram = "1.0"
Basic example:
use std::env;
fn main() {
let anagrams = agram::get(env::args().nth(1).expect("You must provide a word"));
println!("count: {}", anagrams.count);
for word in anagrams.words {
println!(" {word}");
}
}
$ cargo build --release --example basic
$ target/release/examples/basic thing
count: 1
night
The word list is compressed at build time, then decompressed using gzip at runtime. This saves us quite a bit of space in the binary with the drawback that your first request will take a little longer while the library decompresses the list into memory. You can make this faster by calling the init
function in the library.
word list: 4.7M
example binary before compression: 8.1M
example binary after compression: 5.0M