Enum nu_protocol::SyntaxShape
source · pub enum SyntaxShape {
Show 36 variants
Any,
Binary,
Block,
Boolean,
CellPath,
Closure(Option<Vec<SyntaxShape>>),
Custom(Box<SyntaxShape>, DeclId),
DateTime,
Decimal,
Directory,
Duration,
Error,
Expression,
Filepath,
Filesize,
FullCellPath,
GlobPattern,
Int,
ImportPattern,
Keyword(Vec<u8>, Box<SyntaxShape>),
List(Box<SyntaxShape>),
MathExpression,
MatchBlock,
MatchPattern,
Nothing,
Number,
OneOf(Vec<SyntaxShape>),
Operator,
Range,
Record(Vec<(String, SyntaxShape)>),
RowCondition,
Signature,
String,
Table,
Variable,
VarWithOptType,
}
Expand description
The syntactic shapes that values must match to be passed into a command. You can think of this as the type-checking that occurs when you call a function.
Variants§
Any
Any syntactic form is allowed
Binary
A binary literal
Block
A block is allowed, eg {start this thing}
Boolean
A boolean value, eg true
or false
CellPath
A dotted path to navigate the table
Closure(Option<Vec<SyntaxShape>>)
A closure is allowed, eg {|| start this thing}
Custom(Box<SyntaxShape>, DeclId)
A custom shape with custom completion logic
DateTime
A datetime value, eg 2022-02-02
or 2019-10-12T07:20:50.52+00:00
Decimal
A decimal value, eg 1.0
Directory
A directory is allowed
Duration
A duration value is allowed, eg 19day
Error
An error value
Expression
A general expression, eg 1 + 2
or foo --bar
Filepath
A filepath is allowed
Filesize
A filesize value is allowed, eg 10kb
FullCellPath
A dotted path to navigate the table (including variable)
GlobPattern
A glob pattern is allowed, eg foo*
Int
Only an integer value is allowed
ImportPattern
A module path pattern used for imports
Keyword(Vec<u8>, Box<SyntaxShape>)
A specific match to a word or symbol
List(Box<SyntaxShape>)
A list is allowed, eg [first second]
MathExpression
A general math expression, eg 1 + 2
MatchBlock
A block of matches, used by match
MatchPattern
A match pattern, eg {a: $foo}
Nothing
Nothing
Number
Only a numeric (integer or decimal) value is allowed
OneOf(Vec<SyntaxShape>)
One of a list of possible items, checked in order
Operator
An operator, eg +
Range
A range is allowed (eg, 1..3
)
Record(Vec<(String, SyntaxShape)>)
A record value, eg {x: 1, y: 2}
RowCondition
A math expression which expands shorthand forms on the lefthand side, eg foo > 1
The shorthand allows us to more easily reach columns inside of the row being passed in
Signature
A signature for a definition, [x:int, --foo]
String
Strings and string-like bare words are allowed
Table
A table is allowed, eg [[first, second]; [1, 2]]
Variable
A variable name, eg $foo
VarWithOptType
A variable with optional type, x
or x: int
Implementations§
Trait Implementations§
source§impl Clone for SyntaxShape
impl Clone for SyntaxShape
source§fn clone(&self) -> SyntaxShape
fn clone(&self) -> SyntaxShape
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SyntaxShape
impl Debug for SyntaxShape
source§impl<'de> Deserialize<'de> for SyntaxShape
impl<'de> Deserialize<'de> for SyntaxShape
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>,
source§impl Display for SyntaxShape
impl Display for SyntaxShape
source§impl PartialEq<SyntaxShape> for SyntaxShape
impl PartialEq<SyntaxShape> for SyntaxShape
source§fn eq(&self, other: &SyntaxShape) -> bool
fn eq(&self, other: &SyntaxShape) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for SyntaxShape
impl Serialize for SyntaxShape
impl Eq for SyntaxShape
impl StructuralEq for SyntaxShape
impl StructuralPartialEq for SyntaxShape
Auto Trait Implementations§
impl RefUnwindSafe for SyntaxShape
impl Send for SyntaxShape
impl Sync for SyntaxShape
impl Unpin for SyntaxShape
impl UnwindSafe for SyntaxShape
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§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 more§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 more