vortex_scalar/scalarvalue/
bool.rs

1use vortex_error::{VortexError, VortexResult, vortex_err};
2
3use crate::ScalarValue;
4
5impl TryFrom<&ScalarValue> for bool {
6    type Error = VortexError;
7
8    fn try_from(value: &ScalarValue) -> VortexResult<Self> {
9        <Option<bool>>::try_from(value)?
10            .ok_or_else(|| vortex_err!("Can't extract present value from null scalar"))
11    }
12}
13
14impl TryFrom<&ScalarValue> for Option<bool> {
15    type Error = VortexError;
16
17    fn try_from(value: &ScalarValue) -> VortexResult<Self> {
18        value.as_bool()
19    }
20}