| Crates.io | binary-cookies |
| lib.rs | binary-cookies |
| version | 0.3.1 |
| created_at | 2025-07-07 13:45:02.226975+00 |
| updated_at | 2025-08-12 11:47:26.888997+00 |
| description | BinaryCookies decode and encode |
| homepage | https://github.com/saying121/tidy-browser/tree/master/crates/binary-cookies |
| repository | https://github.com/saying121/tidy-browser |
| max_upload_size | |
| id | 1741293 |
| size | 119,319 |
A BinaryCookies decode and encode crate.
See: examples
use std::fs::File;
use binary_cookies::sync::{self, DecodeBinaryCookie};
use snafu::{OptionExt, ResultExt, Whatever};
#[snafu::report]
fn main() -> Result<(), Whatever> {
let mut args = std::env::args();
args.next();
let path = args
.next()
.whatever_context("Need a path")?;
let file = File::open(path).with_whatever_context(|_e| "Open file failed")?;
let a = file
.decode()
.with_whatever_context(|_| "Bad file")?;
let (pages_handle, _meta_decoder) = a.into_handles();
let a = pages_handle
.decoders()
.filter_map(|mut v| v.decode().ok())
.map(sync::CookieHandle::into_decoders)
.flat_map(|v| v.filter_map(|mut v| v.decode().ok()))
.collect::<Vec<_>>();
dbg!(a);
Ok(())
}