mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-09 19:15:27 -05:00
value: add TryFrom for Vec<Value>
This commit is contained in:
@@ -621,6 +621,18 @@ impl Value {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "try_from")]
|
||||
impl TryFrom<Value> for Vec<Value> {
|
||||
type Error = KbinError;
|
||||
|
||||
fn try_from(value: Value) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
Value::Array(_, values) => Ok(values),
|
||||
value => Err(KbinErrorKind::ExpectedValueArray(value).into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "try_from")]
|
||||
impl TryFrom<Value> for Vec<u8> {
|
||||
type Error = KbinError;
|
||||
|
||||
Reference in New Issue
Block a user