1.0.2 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseThis crate implements a plain text serializer and deserializer. It can only
serialize and deserialize primitives and derivatives thereof (like basic enums
or newtypes). It internally uses the FromStr and Display trait to convert
objects around.
To parse a value from a string the from_str helper can be used:
assert_eq!(serde_plain::from_str::<i32>("42").unwrap(), 42);This is particularly useful if enums are in use:
use serde::Deserialize;
#[derive(Deserialize, Debug, PartialEq, Eq)]
pub enum MyEnum {
VariantA,
VariantB,
}
assert_eq!(serde_plain::from_str::<MyEnum>("VariantA").unwrap(), MyEnum::VariantA);The inverse is also possible with to_string:
assert_eq!(serde_plain::to_string(&true).unwrap(), "true");