Cargo Features
[dependencies]
safetensors = { version = "0.5.2", default-features = false, features = ["std", "alloc"] }
- default = std
-
The
std
feature is set by default wheneversafetensors
is added without
somewhere in the dependency tree.default-features = false - std default
-
Enables serde and serde_json
serde:
Provide impls for common standard library types like Vec<T> and HashMap<K, V>.
Requires a dependency on the Rust standard library.Affects
tensor::serialize_to_file
… - alloc = hashbrown
-
Enables alloc of serde and serde_json
serde:
Provide impls for types in the Rust core allocation and collections library including String, Box<T>, Vec<T>, and Cow<T>. This is a subset of std but may be enabled without depending on all of std.
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.