Cargo Features
[dependencies]
serde = { version = "1.0.216", default-features = false, features = ["derive", "std", "unstable", "alloc", "rc"] }
FEATURES
- default = std
-
The
std
feature is set by default wheneverserde
is added without
somewhere in the dependency tree.default-features = false - derive = serde_derive
-
Provide derive(Serialize, Deserialize) macros.
- std default
-
Provide impls for common standard library types like Vec<T> and HashMap<K, V>.
Requires a dependency on the Rust standard library.Affects
de::Deserializer.__deserialize_content
,de::Visitor.visit_string
,de::Visitor.visit_byte_buf
,size_hint::cautious
,value::StringDeserializer
,value::CowStrDeserializer
,de::borrow_cow_str
,de::borrow_cow_bytes
,de::FlatMapDeserializer
,ser::FlatMapSerializer
,ser::FlatMapSerializeMap
,ser::FlatMapSerializeStruct
,ser::FlatMapSerializeTupleVariantAsMapValue
,ser::FlatMapSerializeStructVariantAsMapValue
,ser::Serializer.collect_str
… - unstable
-
Provide impls for types that require unstable functionality. For tracking and discussion of unstable functionality please refer to this issue:
Affects
value::NeverDeserializer
… - alloc
-
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.
Affects
de::Deserializer.__deserialize_content
,de::Visitor.visit_string
,de::Visitor.visit_byte_buf
,size_hint::cautious
,value::StringDeserializer
,value::CowStrDeserializer
,de::borrow_cow_str
,de::borrow_cow_bytes
,de::FlatMapDeserializer
,ser::FlatMapSerializer
,ser::FlatMapSerializeMap
,ser::FlatMapSerializeStruct
,ser::FlatMapSerializeTupleVariantAsMapValue
,ser::FlatMapSerializeStructVariantAsMapValue
,ser::Serializer.collect_str
… - rc
-
Opt into impls for Rc<T> and Arc<T>. Serializing and deserializing these types does not preserve identity and may result in multiple copies of the same data.
Be sure that this is what you want before enabling this feature.
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.