Sha256: bd55c00ad6b937422ebd1a20bd91c46886630f3ff5722008e2eee18bbff2528a

Contents?: true

Size: 446 Bytes

Versions: 13

Compression:

Stored size: 446 Bytes

Contents

fn main() {
    let some_content = "Something";
    let compression_level = 3;

    // Compress some text
    let compressed =
        zstd::encode_all(some_content.as_bytes(), compression_level).unwrap();

    // Now uncompress it
    let decoded: Vec<u8> = zstd::decode_all(compressed.as_slice()).unwrap();

    // Convert it to text
    let decoded_text = std::str::from_utf8(&decoded).unwrap();

    assert_eq!(some_content, decoded_text);
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-28.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-27.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-26.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-25.0.2 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-25.0.1 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-25.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-24.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/basic.rs
wasmtime-23.0.2 ./ext/cargo-vendor/zstd-0.13.1/examples/basic.rs
wasmtime-22.0.0 ./ext/cargo-vendor/zstd-0.13.1/examples/basic.rs
wasmtime-21.0.1 ./ext/cargo-vendor/zstd-0.13.1/examples/basic.rs
wasmtime-20.0.2 ./ext/cargo-vendor/zstd-0.13.1/examples/basic.rs
wasmtime-20.0.0 ./ext/cargo-vendor/zstd-0.13.1/examples/basic.rs