Cargo Features

[dependencies]
litter = { version = "0.20220802.0-dev", default-features = false, features = ["dev-dependencies", "json", "postcard", "toml", "yaml", "write", "mut", "panic", "assertions", "forbid-panic", "forbid-write", "forbid-mut", "forbid-serde", "toke", "serde", "std", "alloc"] }
default = assertions, mut, panic, write

- We omit the serialization features by default.

dev-dependencies = env_logger

Enables fancy of miette ^5.1.1, span-locations of proc-macro2, derive of serde

json = serde, serde_json, std

Crate Feature Flags

Serialization Formats

Support (de)serializing string/byte literals as JSON using serde via the .edit_json() methods.

Affects literal_ext::LiteralExt.edit_json

postcard = serde

Support (de)serializing byte literals as Postcard using serde via the .edit_postcard() methods.

Enables postcard

Affects literal_ext::LiteralExt.edit_postcard

toml = serde, std

Support (de)serializing string/byte literals as TOML using serde via the .edit_toml() methods.

Enables toml ^0.5.9

Affects literal_ext::LiteralExt.edit_toml

yaml = serde, serde_yaml, std

Support (de)serializing string/byte literals as YAML using serde via the .edit_yaml() methods.

Affects literal_ext::LiteralExt.edit_yaml

write default assertions = mut, toke

### Core Capabilities

Support for writing literal mutations back to their source file.

Affects literal_ext::LiteralExt.edit, literal_ext::LiteralExt.edit_json, literal_ext::LiteralExt.edit_postcard, literal_ext::LiteralExt.edit_toml, literal_ext::LiteralExt.edit_yaml, literal_ext::LiteralExt.edit_rkyv

mut default assertions write = parking_lot, std

Support for "mutating" literals.

Enables parking_lot of once_cell

panic default assertions

Include features that may panic on error. (Disabling does not prevent all panics (yet?).)

assertions default = mut, panic, write

### Testing Tools

Include assertion functions for snapshot testing.

Affects assertions::assert_eq

forbid-panic

Forbidding Features

These flags are obviously "non-additive" (contra the normal recommendation), so they should typically only be activated by the root binary, not libraries. These don't disable the corresponding features directly; you'll still need to use default-features = false. Rather, these flags will raise a compile errors if the corresponding features are enabled, to help catch cases where they may inadvertently be reenabled by other crates. These flags are ignored in --all-features builds.

Forbids the use of the panic feature.

forbid-write

Forbids the use of the write feature.

forbid-mut

Forbids the use of the mut feature.

forbid-serde

Forbids the use of features that require serde.

toke write = std

- ### Internal Features

Enables toke

serde dev-dependencies? json? postcard? toml? yaml?
  • Include features that require serde.

Enables serde

std json? mut toke? toml? yaml? = alloc
  • Include features that require the built-in std module (operating system bindings).

Enables std of optional once_cell, use-std of optional postcard, std of optional serde

alloc std?
  • Include features that require the built-in alloc module (memory allocation).

Enables alloc of optional once_cell and optional postcard

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

env_logger dev-dependencies?

Enables env_logger ^0.9.0

once_cell mut
parking_lot mut
proc-macro2 dev-dependencies?
serde_json json?
serde_yaml yaml?

Enables serde_yaml ^0.8.25