ExtractType doesn't have to be implemented for Option any more

This commit is contained in:
est31 2019-09-02 21:12:09 +02:00
parent 3d912a2c1d
commit d5494e58a4

View File

@ -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> {