cbor_core/value/
simple_value.rs1use super::*;
2
3impl From<SimpleValue> for Value {
4 fn from(value: SimpleValue) -> Self {
5 Self::SimpleValue(value)
6 }
7}
8
9impl From<bool> for Value {
10 fn from(value: bool) -> Self {
11 Self::SimpleValue(SimpleValue::from_bool(value))
12 }
13}
14
15impl TryFrom<Value> for bool {
16 type Error = Error;
17 fn try_from(value: Value) -> Result<Self> {
18 value.to_bool()
19 }
20}
21
22impl TryFrom<Value> for SimpleValue {
23 type Error = Error;
24 fn try_from(value: Value) -> Result<Self> {
25 match value {
26 Value::SimpleValue(sv) => Ok(sv),
27 _ => Err(Error::IncompatibleType),
28 }
29 }
30}