syndicate::convert::any_value

This commit is contained in:
Tony Garnock-Jones 2021-08-30 11:56:26 +02:00
parent f0e3e64ffb
commit 8d2b5502be
1 changed files with 6 additions and 0 deletions

View File

@ -24,3 +24,9 @@ pub fn to_any_value<N: NestedValue<D>, D: Embeddable>(v: &N) -> Result<AnyValue,
pub fn from_io_value<V: TryInto<IOValue>>(v: V) -> Result<AnyValue, &'static str> {
to_any_value(&v.try_into().map_err(|_| "Could not convert to IOValue")?)
}
/// Identity function for helping `rustc` decide which
/// [`crate::value::NestedValue`] to use (namely, [`AnyValue`]).
pub fn any_value(v: AnyValue) -> AnyValue {
v
}