Rust

Contents

use utopia_compression::Xz;
Rust
pub struct Xz

XZ: LZMA2 at preset 5 in an .xz container with a CRC64 check.

Rust
use utopia_compression::{Algorithm, Xz};

let xz = Xz::new();
match xz.compress(b"This is a demo string") {
    Ok(body) => assert_eq!(xz.decompress(&body)?, b"This is a demo string"),
    // Built without the `xz` feature.
    Err(e) => assert_eq!(e.php_class(), "Error"),
}