pub enum DeclKind {
Module(Module),
LayeredModules(Vec<Module>),
TableDecl(TableDecl),
InstanceOf(Ident, Option<Ty>),
Column(usize),
Infer(Box<DeclKind>),
Expr(Box<Expr>),
Ty(Ty),
QueryDef(QueryDef),
Import(Ident),
}
Expand description
The Declaration itself.
Variants§
Module(Module)
A nested namespace
LayeredModules(Vec<Module>)
Nested namespaces that do lookup in layers from top to bottom, stopping at first match.
TableDecl(TableDecl)
InstanceOf(Ident, Option<Ty>)
Column(usize)
A single column. Contains id of target which is either:
- an input relation that is source of this column or
- a column expression.
Infer(Box<DeclKind>)
Contains a default value to be created in parent namespace when NS_INFER is matched.
Expr(Box<Expr>)
Ty(Ty)
QueryDef(QueryDef)
Import(Ident)
Equivalent to the declaration pointed to by the fully qualified ident
Implementations§
Source§impl DeclKind
impl DeclKind
Sourcepub fn as_module_mut(&mut self) -> Option<&mut Module>
pub fn as_module_mut(&mut self) -> Option<&mut Module>
Optionally returns mutable references to the inner fields if this is a DeclKind::Module
, otherwise None
Sourcepub fn as_module(&self) -> Option<&Module>
pub fn as_module(&self) -> Option<&Module>
Optionally returns references to the inner fields if this is a DeclKind::Module
, otherwise None
Sourcepub fn into_module(self) -> Result<Module, DeclKind>
pub fn into_module(self) -> Result<Module, DeclKind>
Returns the inner fields if this is a DeclKind::Module
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_layered_modules(&self) -> bool
pub fn is_layered_modules(&self) -> bool
Returns true if this is a DeclKind::LayeredModules
, otherwise false
Sourcepub fn as_layered_modules_mut(&mut self) -> Option<&mut Vec<Module>>
pub fn as_layered_modules_mut(&mut self) -> Option<&mut Vec<Module>>
Optionally returns mutable references to the inner fields if this is a DeclKind::LayeredModules
, otherwise None
Sourcepub fn as_layered_modules(&self) -> Option<&Vec<Module>>
pub fn as_layered_modules(&self) -> Option<&Vec<Module>>
Optionally returns references to the inner fields if this is a DeclKind::LayeredModules
, otherwise None
Sourcepub fn into_layered_modules(self) -> Result<Vec<Module>, DeclKind>
pub fn into_layered_modules(self) -> Result<Vec<Module>, DeclKind>
Returns the inner fields if this is a DeclKind::LayeredModules
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_table_decl(&self) -> bool
pub fn is_table_decl(&self) -> bool
Returns true if this is a DeclKind::TableDecl
, otherwise false
Sourcepub fn as_table_decl_mut(&mut self) -> Option<&mut TableDecl>
pub fn as_table_decl_mut(&mut self) -> Option<&mut TableDecl>
Optionally returns mutable references to the inner fields if this is a DeclKind::TableDecl
, otherwise None
Sourcepub fn as_table_decl(&self) -> Option<&TableDecl>
pub fn as_table_decl(&self) -> Option<&TableDecl>
Optionally returns references to the inner fields if this is a DeclKind::TableDecl
, otherwise None
Sourcepub fn into_table_decl(self) -> Result<TableDecl, DeclKind>
pub fn into_table_decl(self) -> Result<TableDecl, DeclKind>
Returns the inner fields if this is a DeclKind::TableDecl
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_instance_of(&self) -> bool
pub fn is_instance_of(&self) -> bool
Returns true if this is a DeclKind::InstanceOf
, otherwise false
Sourcepub fn as_instance_of_mut(&mut self) -> Option<(&mut Ident, &mut Option<Ty>)>
pub fn as_instance_of_mut(&mut self) -> Option<(&mut Ident, &mut Option<Ty>)>
Optionally returns mutable references to the inner fields if this is a DeclKind::InstanceOf
, otherwise None
Sourcepub fn as_instance_of(&self) -> Option<(&Ident, &Option<Ty>)>
pub fn as_instance_of(&self) -> Option<(&Ident, &Option<Ty>)>
Optionally returns references to the inner fields if this is a DeclKind::InstanceOf
, otherwise None
Sourcepub fn into_instance_of(self) -> Result<(Ident, Option<Ty>), DeclKind>
pub fn into_instance_of(self) -> Result<(Ident, Option<Ty>), DeclKind>
Returns the inner fields if this is a DeclKind::InstanceOf
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_column_mut(&mut self) -> Option<&mut usize>
pub fn as_column_mut(&mut self) -> Option<&mut usize>
Optionally returns mutable references to the inner fields if this is a DeclKind::Column
, otherwise None
Sourcepub fn as_column(&self) -> Option<&usize>
pub fn as_column(&self) -> Option<&usize>
Optionally returns references to the inner fields if this is a DeclKind::Column
, otherwise None
Sourcepub fn into_column(self) -> Result<usize, DeclKind>
pub fn into_column(self) -> Result<usize, DeclKind>
Returns the inner fields if this is a DeclKind::Column
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_infer_mut(&mut self) -> Option<&mut Box<DeclKind>>
pub fn as_infer_mut(&mut self) -> Option<&mut Box<DeclKind>>
Optionally returns mutable references to the inner fields if this is a DeclKind::Infer
, otherwise None
Sourcepub fn as_infer(&self) -> Option<&Box<DeclKind>>
pub fn as_infer(&self) -> Option<&Box<DeclKind>>
Optionally returns references to the inner fields if this is a DeclKind::Infer
, otherwise None
Sourcepub fn into_infer(self) -> Result<Box<DeclKind>, DeclKind>
pub fn into_infer(self) -> Result<Box<DeclKind>, DeclKind>
Returns the inner fields if this is a DeclKind::Infer
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_expr_mut(&mut self) -> Option<&mut Box<Expr>>
pub fn as_expr_mut(&mut self) -> Option<&mut Box<Expr>>
Optionally returns mutable references to the inner fields if this is a DeclKind::Expr
, otherwise None
Sourcepub fn as_expr(&self) -> Option<&Box<Expr>>
pub fn as_expr(&self) -> Option<&Box<Expr>>
Optionally returns references to the inner fields if this is a DeclKind::Expr
, otherwise None
Sourcepub fn into_expr(self) -> Result<Box<Expr>, DeclKind>
pub fn into_expr(self) -> Result<Box<Expr>, DeclKind>
Returns the inner fields if this is a DeclKind::Expr
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_ty_mut(&mut self) -> Option<&mut Ty>
pub fn as_ty_mut(&mut self) -> Option<&mut Ty>
Optionally returns mutable references to the inner fields if this is a DeclKind::Ty
, otherwise None
Sourcepub fn as_ty(&self) -> Option<&Ty>
pub fn as_ty(&self) -> Option<&Ty>
Optionally returns references to the inner fields if this is a DeclKind::Ty
, otherwise None
Sourcepub fn into_ty(self) -> Result<Ty, DeclKind>
pub fn into_ty(self) -> Result<Ty, DeclKind>
Returns the inner fields if this is a DeclKind::Ty
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_query_def(&self) -> bool
pub fn is_query_def(&self) -> bool
Returns true if this is a DeclKind::QueryDef
, otherwise false
Sourcepub fn as_query_def_mut(&mut self) -> Option<&mut QueryDef>
pub fn as_query_def_mut(&mut self) -> Option<&mut QueryDef>
Optionally returns mutable references to the inner fields if this is a DeclKind::QueryDef
, otherwise None
Sourcepub fn as_query_def(&self) -> Option<&QueryDef>
pub fn as_query_def(&self) -> Option<&QueryDef>
Optionally returns references to the inner fields if this is a DeclKind::QueryDef
, otherwise None
Sourcepub fn into_query_def(self) -> Result<QueryDef, DeclKind>
pub fn into_query_def(self) -> Result<QueryDef, DeclKind>
Returns the inner fields if this is a DeclKind::QueryDef
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_import_mut(&mut self) -> Option<&mut Ident>
pub fn as_import_mut(&mut self) -> Option<&mut Ident>
Optionally returns mutable references to the inner fields if this is a DeclKind::Import
, otherwise None
Sourcepub fn as_import(&self) -> Option<&Ident>
pub fn as_import(&self) -> Option<&Ident>
Optionally returns references to the inner fields if this is a DeclKind::Import
, otherwise None
Sourcepub fn into_import(self) -> Result<Ident, DeclKind>
pub fn into_import(self) -> Result<Ident, DeclKind>
Returns the inner fields if this is a DeclKind::Import
, otherwise returns back the enum in the Err
case of the result
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DeclKind
impl<'de> Deserialize<'de> for DeclKind
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DeclKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DeclKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for DeclKind
impl Serialize for DeclKind
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for DeclKind
Auto Trait Implementations§
impl Freeze for DeclKind
impl RefUnwindSafe for DeclKind
impl Send for DeclKind
impl Sync for DeclKind
impl Unpin for DeclKind
impl UnwindSafe for DeclKind
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<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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);