1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::convert::TryFrom;
use failure::Error;
use crate::bolt::value::Boolean;
use crate::error::ValueError;
use crate::Value;
impl From<Boolean> for bool {
fn from(boolean: Boolean) -> Self {
boolean.value
}
}
impl TryFrom<Value> for bool {
type Error = Error;
fn try_from(value: Value) -> Result<Self, Self::Error> {
match value {
Value::Boolean(boolean) => Ok(bool::from(boolean)),
_ => Err(ValueError::InvalidConversion(value).into()),
}
}
}