Giter Site home page Giter Site logo

lzham's Introduction

lzham

High-level Rust bindings for lzham codec built upon the lower-level lzham-sys crate.

You must have cmake and a C++ compiler to build this crate, as the lzham-sys crate builds lzham library and does not search for a prebuilt library.

Usage

Add the following to your Cargo.toml:

[dependencies]
lzham = "0.1.1"

Examples

use lzham::{compress, decompress};
let data = String::from("This is a test.");

let mut comp = Vec::new();
let status = compress(&mut data.as_bytes(), &mut comp);

assert!(status.is_success());

let mut decomp = Vec::new();
let status = decompress(&mut comp.as_slice(), &mut decomp, data.len());

assert!(status.is_success());

Linking

lzham supports both static and dynamic linking. To link statically, you can either set LIBLZHAM_STATIC or LZHAM_STATIC environment variables to true, or use the static feature.

To link dynamically, use the dynamic feature.

If you don't set any environment variables or use any features, the build will be the expected default library linking method based on OS or target. For Windows, macOS and Linux with musl, it will be static. For Linux without musl, it will be dynamic.

Note that environment variables take precedence over features. In case of any ambiguity, it uses the default linking method.

Features

The crate has the following two features:

  • static: Links to the library statically
  • dynamic: Links to the library dynamically

These set the appropriate lzham-sys features, which is responsible for building and linking the library.

License

lzham is available under the MIT license. See LICENSE for more details.

lzham's People

Contributors

nextonesfaster avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

the-eater

lzham's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.