Cargo Features

[dependencies]
gitoid = { version = "0.8.0", default-features = false, features = ["async", "hex", "serde", "sha1", "sha1cd", "sha256", "std", "url", "rustcrypto", "boringssl", "openssl"] }
default = async, hex, rustcrypto, serde, sha1, sha1cd, sha256, std, url

By default, you get:

- Hashes: sha1, sha1cd, sha256.
- Async: ability to asynchronously produce GitOIDs using the Tokio runtime.
- Hex: ability to print a GitOid with a hexadecimal hash representation.
- Url: ability to convert a GitOid to and from a gitoid-scheme URL.
- Serde: ability to serialize and deserialize a GitOid to and from a URL.
- Rustcrypto: use the RustCrypto crates as the cryptography backend.

async default = std

Async support is optional. That said, it's currently only with Tokio, meaning you'd need to handle integrating with any other async runtime yourself. In the future it may be nice to make our async support fully generic and not specific to a given runtime.

Note also that async support implies using the standard library, as Tokio is not no_std-compatible.

Enables tokio

Need "rt" and "fs" additionally for tests.

hex default url = std

Get the ability to print the contents of the hash buffer as a hexadecimal string.

This relies on std as we don't currently expose a no_std-compatible variant of our API's which use hex.

Enables hex

serde default = std, url

Get the ability to serialize and deserialize GitOids.

Enables serde

sha1 default boringssl? openssl?

All hash algorithms are optional, though you need to have at least one algorithm turned on for this crate to be useful. This is intended to just let you avoid paying the cost of algorithms you don't use.

Enables sha1

Affects boringssl::Sha256, boringssl::Sha1, openssl::Sha256, openssl::Sha1, rustcrypto::Sha1

sha1cd default

Enables sha1collisiondetection

Affects rustcrypto::Sha1Cd

sha256 default boringssl? openssl?

Enables sha2

Affects rustcrypto::Sha256

std default async hex serde url

Get standard library support.

This feature is enabled by default. You can disable it to run in environments without std, usually embedded environments.

Enables std of optional sha1, optional sha1collisiondetection, and optional sha2 and format-bytes

std-requiring dependencies.

and std of digest

no_std compatible dependencies.

NOTE: Must match the version used in the hash crate.

Technically, we could rely on the re-export from one of those crates,
but since all the hash crates are optional dependencies our usage code within the 'gitoid' crate would be more complex to handle the possibility for any/all of them to be missing. It's simpler to just specify it here so we know we always get the crate.

url default serde = hex, std

Get the ability to construct and get out URLs.

This relies on std as the url crate isn't no_std-compatible. This also relies on hex as the URL includes the hex-encoded hash.

Enables url

rustcrypto default

Enable using RustCrypto as a cryptography backend.

Affects backend::rustcrypto

boringssl = sha1, sha256

Enable using BoringSLL as a cryptography backend.

NOTE: This unconditionally turns on the "sha1" and "sha256" features, because the boring crate which provides the BoringSSL cryptography implementations does not permit conditionally compiling those implementations out. Since they're always present, we might as well use them unconditionally.

Enables boring

Affects backend::boringssl

openssl = sha1, sha256

Enable using OpenSSL as a cryptography backend.

NOTE: Like the "boringssl" feature, this unconditionally turns on the "sha1" and "sha256" features, as they're not able to be conditionally compiled out of the dependency, so there's no reason to omit them here.

Enables openssl

Affects backend::openssl