mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
testing suite for dataframes (#379)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use std::fmt;
|
||||
use std::{cmp::Ordering, fmt};
|
||||
|
||||
use crate::{ast::Operator, Category, ShellError, Span, Value};
|
||||
|
||||
@ -29,6 +29,9 @@ pub trait CustomValue: fmt::Debug + Send + Sync {
|
||||
fn follow_path_int(&self, count: usize, span: Span) -> Result<Value, ShellError>;
|
||||
fn follow_path_string(&self, column_name: String, span: Span) -> Result<Value, ShellError>;
|
||||
|
||||
// ordering with other value
|
||||
fn partial_cmp(&self, other: &Value) -> Option<Ordering>;
|
||||
|
||||
// Definition of an operation between the object that implements the trait
|
||||
// and another Value.
|
||||
// The Operator enum is used to indicate the expected operation
|
||||
|
@ -1,5 +1,14 @@
|
||||
use crate::{ShellError, Span, Value};
|
||||
|
||||
impl From<String> for Value {
|
||||
fn from(val: String) -> Self {
|
||||
Value::String {
|
||||
val,
|
||||
span: Span::unknown(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for Value {
|
||||
fn from(val: bool) -> Self {
|
||||
Value::Bool {
|
||||
|
@ -640,6 +640,7 @@ impl PartialOrd for Value {
|
||||
(Value::Binary { val: lhs, .. }, Value::Binary { val: rhs, .. }) => {
|
||||
lhs.partial_cmp(rhs)
|
||||
}
|
||||
(Value::CustomValue { val: lhs, .. }, rhs) => lhs.partial_cmp(rhs),
|
||||
(Value::Nothing { .. }, Value::Nothing { .. }) => Some(Ordering::Equal),
|
||||
(_, _) => None,
|
||||
}
|
||||
|
Reference in New Issue
Block a user