Enum yaml_peg::serialize::Stringify [−][src]
This is supported on crate feature
serde
only.Expand description
A type that can deserialize from any data to string type.
It just like YamlBase
but no null value, anchor type and containers.
Calling ToString::to_string
can convert the data into string.
use serde::Deserialize;
use yaml_peg::{node, serialize::Stringify};
#[derive(Deserialize)]
struct Content {
width: Stringify,
}
let n_value = node!({"width" => 20});
let n_percent = node!({"width" => "20%"});
let value = Content::deserialize(n_value).unwrap();
let percent = Content::deserialize(n_percent).unwrap();
assert_eq!("20", value.width.to_string());
assert_eq!("20%", percent.width.to_string());
Variants
Bool(bool)
Boolean value.
Tuple Fields of Bool
0: bool
Int(i32)
Integer value.
Tuple Fields of Int
0: i32
Float(f32)
Float value.
Tuple Fields of Float
0: f32
Str(String)
String value.
Tuple Fields of Str
0: String
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more