mirror of
https://github.com/nushell/nushell.git
synced 2025-01-08 15:30:24 +01:00
ExtractType doesn't have to be implemented for Option any more
This commit is contained in:
parent
3d912a2c1d
commit
d5494e58a4
@ -15,19 +15,6 @@ impl<T> ExtractType for T {
|
||||
)))
|
||||
}
|
||||
}
|
||||
impl<T: ExtractType> ExtractType for Option<T> {
|
||||
fn extract(value: &Tagged<Value>) -> Result<Option<T>, ShellError> {
|
||||
let name = std::any::type_name::<T>();
|
||||
trace!("<Option> Extracting {:?} for Option<{}>", value, name);
|
||||
|
||||
let result = match value.item() {
|
||||
Value::Primitive(Primitive::Nothing) => None,
|
||||
_ => Some(T::extract(value)?),
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ExtractType> ExtractType for Tagged<T> {
|
||||
fn extract(value: &Tagged<Value>) -> Result<Tagged<T>, ShellError> {
|
||||
|
Loading…
Reference in New Issue
Block a user