pub enum Type {
Show 22 variants
Any,
Binary,
Block,
Bool,
CellPath,
Closure,
Custom(Box<str>),
Date,
Duration,
Error,
Filesize,
Float,
Int,
List(Box<Type>),
Nothing,
Number,
OneOf(OneOf),
Range,
Record(CollectionColumns<Type>),
String,
Glob,
Table(CollectionColumns<Type>),
}Variants§
Any
Top type, supertype of all types
Binary
Block
Bool
CellPath
Closure
Custom(Box<str>)
Date
Duration
Error
Filesize
Float
Int
List(Box<Type>)
Nothing
Number
Supertype of Int and Float. Equivalent to oneof<int, float>
OneOf(OneOf)
Supertype of all types it contains.
Range
Record(CollectionColumns<Type>)
String
Glob
Table(CollectionColumns<Type>)
Implementations§
Source§impl Type
impl Type
pub fn list(inner: Type) -> Self
Sourcepub fn one_of(types: impl IntoIterator<Item = Type>) -> Self
pub fn one_of(types: impl IntoIterator<Item = Type>) -> Self
Creates a OneOf type from an iterator of types. Flattens any nested OneOf types and removes duplicates.
pub fn record() -> Self
pub fn table() -> Self
pub fn custom(name: impl Into<Box<str>>) -> Self
Sourcepub fn supertype_of(it: impl IntoIterator<Item = Type>) -> Option<Self>
pub fn supertype_of(it: impl IntoIterator<Item = Type>) -> Option<Self>
Returns a supertype of all types within it that is not Any.
If it contains Type::Any, short circuits and returns None.
pub fn is_numeric(&self) -> bool
pub fn is_list(&self) -> bool
Sourcepub fn accepts_cell_paths(&self) -> bool
pub fn accepts_cell_paths(&self) -> bool
Does this type represent a data structure containing values that can be addressed using ‘cell paths’?
pub fn to_shape(&self) -> SyntaxShape
Sourcepub fn get_non_specified_string(&self) -> String
pub fn get_non_specified_string(&self) -> String
Get a string representation, without inner type specification of lists,
tables and records (get list instead of list<any>
pub fn follow_cell_path<'a>( &'a self, path_members: &'a [PathMember], ) -> Option<Cow<'a, Self>>
Trait Implementations§
Source§impl CompareTypes for Type
impl CompareTypes for Type
Source§fn is_subtype_of(&self, other: &Self) -> bool
fn is_subtype_of(&self, other: &Self) -> bool
Determine of the Type is a subtype of other.
This should only be used at parse-time.
If you have a concrete Value or PipelineData,
you should use their respective is_subtype_of methods instead.
Source§fn compare_types(&self, other: &Self) -> Option<TypeRelation>
fn compare_types(&self, other: &Self) -> Option<TypeRelation>
Source§fn is_assignable_to(&self, dst: &Self) -> bool
fn is_assignable_to(&self, dst: &Self) -> bool
CompareTypes::is_subtype_of by default. Read moreSource§impl CompareTypes<OneOf> for Type
impl CompareTypes<OneOf> for Type
Source§fn compare_types(&self, other: &OneOf) -> Option<TypeRelation>
fn compare_types(&self, other: &OneOf) -> Option<TypeRelation>
Source§fn is_subtype_of(&self, other: &OneOf) -> bool
fn is_subtype_of(&self, other: &OneOf) -> bool
Source§fn is_supertype_of(&self, other: &OneOf) -> bool
fn is_supertype_of(&self, other: &OneOf) -> bool
Source§fn is_assignable_to(&self, dst: &OneOf) -> bool
fn is_assignable_to(&self, dst: &OneOf) -> bool
CompareTypes::is_subtype_of by default. Read moreSource§impl CompareTypes<Type> for OneOf
impl CompareTypes<Type> for OneOf
Source§fn compare_types(&self, other: &Type) -> Option<TypeRelation>
fn compare_types(&self, other: &Type) -> Option<TypeRelation>
Source§fn is_subtype_of(&self, other: &Type) -> bool
fn is_subtype_of(&self, other: &Type) -> bool
Source§fn is_supertype_of(&self, other: &Type) -> bool
fn is_supertype_of(&self, other: &Type) -> bool
Source§fn is_assignable_to(&self, dst: &Type) -> bool
fn is_assignable_to(&self, dst: &Type) -> bool
CompareTypes::is_subtype_of by default. Read moreSource§impl CompareTypes<Type> for PipelineData
impl CompareTypes<Type> for PipelineData
Source§fn is_assignable_to(&self, dst: &Type) -> bool
fn is_assignable_to(&self, dst: &Type) -> bool
Determine if the PipelineData can be assigned to other.
This check makes no effort to collect a stream, so it may be a different result
than would be returned by calling Value::is_subtype_of() on the result of
.into_value().
A ListStream acts the same as an empty list type: it is a subtype of any list
or table type. After converting to a value, it may become a more specific type.
For example, a ListStream is a subtype of list<int> and list<string>.
If calling .into_value() results in a list<int>,
then the value would not be a subtype of list<string>, in contrast to the original ListStream.
A ByteStream is a subtype of string if it is coercible into a string.
Likewise, a ByteStream is a subtype of binary if it is coercible into a binary value.
Source§fn compare_types(&self, other: &Type) -> Option<TypeRelation>
fn compare_types(&self, other: &Type) -> Option<TypeRelation>
Source§fn is_subtype_of(&self, other: &Rhs) -> bool
fn is_subtype_of(&self, other: &Rhs) -> bool
Source§fn is_supertype_of(&self, other: &Rhs) -> bool
fn is_supertype_of(&self, other: &Rhs) -> bool
Source§impl CompareTypes<Type> for Value
impl CompareTypes<Type> for Value
Source§fn is_subtype_of(&self, other: &Type) -> bool
fn is_subtype_of(&self, other: &Type) -> bool
Determine if the Value is a subtype of other
If you have a Value, this method should always be used over chaining Value::get_type with Type::is_subtype_of.
This method is able to leverage that information encoded in a Value to provide more accurate
type comparison than if one were to collect the type into Type value with Value::get_type.
Empty lists are considered subtypes of all list<T> types.
Lists of mixed records where some column is present in all record is a subtype of table<column>.
For example, [{a: 1, b: 2}, {a: 1}] is a subtype of table<a: int> (but not table<a: int, b: int>).
See also: PipelineData::is_subtype_of
Source§fn compare_types(&self, other: &Type) -> Option<TypeRelation>
fn compare_types(&self, other: &Type) -> Option<TypeRelation>
Source§fn is_supertype_of(&self, other: &Rhs) -> bool
fn is_supertype_of(&self, other: &Rhs) -> bool
Source§fn is_assignable_to(&self, dst: &Rhs) -> bool
fn is_assignable_to(&self, dst: &Rhs) -> bool
CompareTypes::is_subtype_of by default. Read moreSource§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Type
Source§impl From<ByteStreamType> for Type
impl From<ByteStreamType> for Type
Source§fn from(value: ByteStreamType) -> Self
fn from(value: ByteStreamType) -> Self
Source§impl FromIterator<Type> for OneOf
impl FromIterator<Type> for OneOf
Source§impl Ord for Type
impl Ord for Type
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Type
impl PartialOrd for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin for Type
impl UnwindSafe for Type
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSpanned for T
impl<T> IntoSpanned for T
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> ToLeanString for Twhere
T: Display,
impl<T> ToLeanString for Twhere
T: Display,
Source§fn try_to_lean_string(&self) -> Result<LeanString, ToLeanStringError>
fn try_to_lean_string(&self) -> Result<LeanString, ToLeanStringError>
LeanString. Read moreSource§fn to_lean_string(&self) -> LeanString
fn to_lean_string(&self) -> LeanString
LeanString. Read more