mirror of
https://github.com/danbulant/nushell
synced 2026-05-24 12:35:59 +00:00
ExtractType doesn't have to be implemented for Option any more
This commit is contained in:
parent
3d912a2c1d
commit
d5494e58a4
1 changed files with 0 additions and 13 deletions
|
|
@ -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> {
|
impl<T: ExtractType> ExtractType for Tagged<T> {
|
||||||
fn extract(value: &Tagged<Value>) -> Result<Tagged<T>, ShellError> {
|
fn extract(value: &Tagged<Value>) -> Result<Tagged<T>, ShellError> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue