2
0
Fork 0
mirror of https://github.com/nushell/nushell synced 2025-02-14 21:18:49 +00:00
nushell/src/object/into.rs

24 lines
509 B
Rust
Raw Normal View History

2019-07-08 09:44:53 -07:00
use crate::object::{Primitive, Value};
use crate::prelude::*;
impl From<Primitive> for Value {
fn from(input: Primitive) -> Value {
Value::Primitive(input)
}
}
impl From<String> for Value {
fn from(input: String) -> Value {
Value::Primitive(Primitive::String(input))
}
}
impl<T: Into<Value>> Spanned<T> {
pub fn into_spanned_value(self) -> Spanned<Value> {
let Spanned { item, span } = self;
let value = item.into();
value.spanned(span)
}
}