pub enum Expr {
Show 39 variants
Let {
variable_id: VariableId,
type_annotation: Option<TypeName>,
expr: Box<Expr>,
inferred_type: InferredType,
source_span: SourceSpan,
},
SelectField {
expr: Box<Expr>,
field: String,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
SelectIndex {
expr: Box<Expr>,
index: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Sequence {
exprs: Vec<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Range {
range: Range,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Record {
exprs: Vec<(String, Box<Expr>)>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Tuple {
exprs: Vec<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Literal {
value: String,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Number {
number: Number,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Flags {
flags: Vec<String>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Identifier {
variable_id: VariableId,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Boolean {
value: bool,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Concat {
exprs: Vec<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
ExprBlock {
exprs: Vec<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Not {
expr: Box<Expr>,
inferred_type: InferredType,
type_annotation: Option<TypeName>,
source_span: SourceSpan,
},
GreaterThan {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
And {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Or {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
GreaterThanOrEqualTo {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
LessThanOrEqualTo {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Plus {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Multiply {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Minus {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Divide {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
EqualTo {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
LessThan {
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Cond {
cond: Box<Expr>,
lhs: Box<Expr>,
rhs: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
PatternMatch {
predicate: Box<Expr>,
match_arms: Vec<MatchArm>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Option {
expr: Option<Box<Expr>>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Result {
expr: Result<Box<Expr>, Box<Expr>>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Call {
call_type: CallType,
generic_type_parameter: Option<GenericTypeParameter>,
args: Vec<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
InvokeMethodLazy {
lhs: Box<Expr>,
method: String,
generic_type_parameter: Option<GenericTypeParameter>,
args: Vec<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Unwrap {
expr: Box<Expr>,
inferred_type: InferredType,
type_annotation: Option<TypeName>,
source_span: SourceSpan,
},
Throw {
message: String,
inferred_type: InferredType,
type_annotation: Option<TypeName>,
source_span: SourceSpan,
},
GetTag {
expr: Box<Expr>,
inferred_type: InferredType,
type_annotation: Option<TypeName>,
source_span: SourceSpan,
},
ListComprehension {
iterated_variable: VariableId,
iterable_expr: Box<Expr>,
yield_expr: Box<Expr>,
type_annotation: Option<TypeName>,
inferred_type: InferredType,
source_span: SourceSpan,
},
ListReduce {
reduce_variable: VariableId,
iterated_variable: VariableId,
iterable_expr: Box<Expr>,
type_annotation: Option<TypeName>,
yield_expr: Box<Expr>,
init_value_expr: Box<Expr>,
inferred_type: InferredType,
source_span: SourceSpan,
},
Length {
expr: Box<Expr>,
inferred_type: InferredType,
type_annotation: Option<TypeName>,
source_span: SourceSpan,
},
GenerateWorkerName {
inferred_type: InferredType,
type_annotation: Option<TypeName>,
source_span: SourceSpan,
variable_id: Option<VariableId>,
},
}Variants§
Let
SelectField
SelectIndex
Sequence
Range
Record
Tuple
Literal
Number
Flags
Identifier
Boolean
Concat
ExprBlock
Not
GreaterThan
And
Or
GreaterThanOrEqualTo
LessThanOrEqualTo
Plus
Multiply
Minus
Divide
EqualTo
LessThan
Cond
PatternMatch
Option
Result
Call
InvokeMethodLazy
Unwrap
Throw
GetTag
ListComprehension
ListReduce
Fields
§
reduce_variable: VariableId§
iterated_variable: VariableId§
inferred_type: InferredType§
source_span: SourceSpanLength
GenerateWorkerName
Implementations§
Source§impl Expr
impl Expr
pub fn as_record(&self) -> Option<Vec<(String, Expr)>>
Sourcepub fn from_text(input: &str) -> Result<Expr, String>
pub fn from_text(input: &str) -> Result<Expr, String>
Parse a text directly as Rib expression Example of a Rib expression:
let shopping-cart-worker = instance("my-worker");
let result = shopping-cart-worker.add-to-cart({product-name: "apple", quantity: 2});
match result {
ok(id) => "product-id-${id}",
err(error_msg) => "Error: ${error_msg}"
}Rib supports conditional calls, function calls, pattern-matching, string interpolation (see error_message above) etc.
pub fn lookup(&self, source_span: &SourceSpan) -> Option<Expr>
pub fn is_literal(&self) -> bool
pub fn is_block(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_record(&self) -> bool
pub fn is_result(&self) -> bool
pub fn is_option(&self) -> bool
pub fn is_tuple(&self) -> bool
pub fn is_list(&self) -> bool
pub fn is_flags(&self) -> bool
pub fn is_identifier(&self) -> bool
pub fn is_select_field(&self) -> bool
pub fn is_if_else(&self) -> bool
pub fn is_function_call(&self) -> bool
pub fn is_match_expr(&self) -> bool
pub fn is_boolean(&self) -> bool
pub fn is_comparison(&self) -> bool
pub fn is_concat(&self) -> bool
pub fn is_multiple(&self) -> bool
pub fn inbuilt_variant(&self) -> Option<(String, Option<Expr>)>
pub fn unwrap(&self) -> Self
pub fn length(expr: Expr) -> Self
pub fn boolean(value: bool) -> Self
pub fn and(left: Expr, right: Expr) -> Self
pub fn throw(message: impl AsRef<str>) -> Self
pub fn generate_worker_name(variable_id: Option<VariableId>) -> Self
pub fn plus(left: Expr, right: Expr) -> Self
pub fn minus(left: Expr, right: Expr) -> Self
pub fn divide(left: Expr, right: Expr) -> Self
pub fn multiply(left: Expr, right: Expr) -> Self
pub fn and_combine(conditions: Vec<Expr>) -> Option<Expr>
pub fn call_worker_function( dynamic_parsed_fn_name: DynamicParsedFunctionName, generic_type_parameter: Option<GenericTypeParameter>, module_identifier: Option<InstanceIdentifier>, args: Vec<Expr>, component_info: Option<ComponentDependencyKey>, ) -> Self
pub fn call( call_type: CallType, generic_type_parameter: Option<GenericTypeParameter>, args: Vec<Expr>, ) -> Self
pub fn invoke_worker_function( lhs: Expr, function_name: String, generic_type_parameter: Option<GenericTypeParameter>, args: Vec<Expr>, ) -> Self
pub fn concat(expressions: Vec<Expr>) -> Self
pub fn cond(cond: Expr, lhs: Expr, rhs: Expr) -> Self
pub fn equal_to(left: Expr, right: Expr) -> Self
pub fn err(expr: Expr, type_annotation: Option<TypeName>) -> Self
pub fn flags(flags: Vec<String>) -> Self
pub fn greater_than(left: Expr, right: Expr) -> Self
pub fn greater_than_or_equal_to(left: Expr, right: Expr) -> Self
pub fn identifier_global( name: impl AsRef<str>, type_annotation: Option<TypeName>, ) -> Self
pub fn identifier_local( name: impl AsRef<str>, id: u32, type_annotation: Option<TypeName>, ) -> Self
pub fn identifier_with_variable_id( variable_id: VariableId, type_annotation: Option<TypeName>, ) -> Self
pub fn less_than(left: Expr, right: Expr) -> Self
pub fn less_than_or_equal_to(left: Expr, right: Expr) -> Self
pub fn range(from: Expr, to: Expr) -> Self
pub fn range_from(from: Expr) -> Self
pub fn range_inclusive(from: Expr, to: Expr) -> Self
pub fn let_binding( name: impl AsRef<str>, expr: Expr, type_annotation: Option<TypeName>, ) -> Self
pub fn let_binding_with_variable_id( variable_id: VariableId, expr: Expr, type_annotation: Option<TypeName>, ) -> Self
pub fn typed_list_reduce( reduce_variable: VariableId, iterated_variable: VariableId, iterable_expr: Expr, init_value_expr: Expr, yield_expr: Expr, inferred_type: InferredType, ) -> Self
pub fn list_reduce( reduce_variable: VariableId, iterated_variable: VariableId, iterable_expr: Expr, init_value_expr: Expr, yield_expr: Expr, ) -> Self
pub fn list_comprehension_typed( iterated_variable: VariableId, iterable_expr: Expr, yield_expr: Expr, inferred_type: InferredType, ) -> Self
pub fn list_comprehension( variable_id: VariableId, iterable_expr: Expr, yield_expr: Expr, ) -> Self
pub fn bind_global_variable_types( &mut self, type_spec: &Vec<GlobalVariableTypeSpec>, )
pub fn bind_instance_types(&mut self)
pub fn literal(value: impl AsRef<str>) -> Self
pub fn empty_expr() -> Self
pub fn expr_block(expressions: Vec<Expr>) -> Self
pub fn not(expr: Expr) -> Self
pub fn ok(expr: Expr, type_annotation: Option<TypeName>) -> Self
pub fn option(expr: Option<Expr>) -> Self
pub fn or(left: Expr, right: Expr) -> Self
pub fn pattern_match(expr: Expr, match_arms: Vec<MatchArm>) -> Self
pub fn record(expressions: Vec<(String, Expr)>) -> Self
pub fn select_field( expr: Expr, field: impl AsRef<str>, type_annotation: Option<TypeName>, ) -> Self
pub fn select_index(expr: Expr, index: Expr) -> Self
pub fn get_tag(expr: Expr) -> Self
pub fn tuple(expressions: Vec<Expr>) -> Self
pub fn sequence( expressions: Vec<Expr>, type_annotation: Option<TypeName>, ) -> Self
pub fn inferred_type_mut(&mut self) -> &mut InferredType
pub fn inferred_type(&self) -> InferredType
pub fn infer_types( &mut self, component_dependency: &ComponentDependencies, global_variable_type_spec: &Vec<GlobalVariableTypeSpec>, custom_instance_spec: &[CustomInstanceSpec], ) -> Result<(), RibTypeErrorInternal>
pub fn infer_types_initial_phase( &mut self, component_dependency: &ComponentDependencies, global_variable_type_spec: &Vec<GlobalVariableTypeSpec>, custom_instance_spec: &[CustomInstanceSpec], ) -> Result<(), RibTypeErrorInternal>
pub fn resolve_method_calls(&mut self) -> Result<(), RibTypeErrorInternal>
pub fn set_origin(&mut self)
pub fn inference_scan( &mut self, component_dependencies: &ComponentDependencies, custom_instance_spec: &[CustomInstanceSpec], ) -> Result<(), RibTypeErrorInternal>
pub fn infer_worker_function_invokes( &mut self, ) -> Result<(), RibTypeErrorInternal>
pub fn bind_variables_of_pattern_match(&mut self)
pub fn bind_variables_of_let_assignment(&mut self)
pub fn bind_variables_of_list_comprehension(&mut self)
pub fn bind_variables_of_list_reduce(&mut self)
pub fn identify_instance_creation( &mut self, component_dependency: &ComponentDependencies, custom_instance_spec: &[CustomInstanceSpec], ) -> Result<(), RibTypeErrorInternal>
pub fn ensure_stateful_instance(&mut self)
pub fn infer_function_call_types( &mut self, component_dependency: &ComponentDependencies, custom_instance_spec: &[CustomInstanceSpec], ) -> Result<(), RibTypeErrorInternal>
pub fn push_types_down(&mut self) -> Result<(), RibTypeErrorInternal>
pub fn infer_all_identifiers(&mut self)
pub fn pull_types_up( &mut self, component_dependencies: &ComponentDependencies, ) -> Result<(), RibTypeErrorInternal>
pub fn infer_global_inputs(&mut self)
pub fn bind_type_annotations(&mut self)
pub fn check_types( &mut self, component_dependency: &ComponentDependencies, ) -> Result<(), RibTypeErrorInternal>
pub fn unify_types(&mut self) -> Result<(), RibTypeErrorInternal>
pub fn merge_inferred_type(&self, new_inferred_type: InferredType) -> Expr
pub fn add_infer_type_mut(&mut self, new_inferred_type: InferredType)
pub fn reset_type(&mut self)
pub fn source_span(&self) -> SourceSpan
pub fn type_annotation(&self) -> &Option<TypeName>
pub fn with_type_annotation_opt( &self, type_annotation: Option<TypeName>, ) -> Expr
pub fn with_type_annotation(&self, type_annotation: TypeName) -> Expr
pub fn with_type_annotation_mut(&mut self, type_annotation: TypeName)
pub fn with_source_span(&self, new_source_span: SourceSpan) -> Expr
pub fn with_source_span_mut(&mut self, new_source_span: SourceSpan)
pub fn with_inferred_type(&self, new_inferred_type: InferredType) -> Expr
pub fn with_inferred_type_mut(&mut self, new_inferred_type: InferredType)
pub fn infer_enums(&mut self, component_dependency: &ComponentDependencies)
pub fn infer_variants(&mut self, component_dependency: &ComponentDependencies)
pub fn visit_expr_nodes_lazy<'a>( &'a mut self, queue: &mut VecDeque<&'a mut Expr>, )
pub fn number_inferred( big_decimal: BigDecimal, type_annotation: Option<TypeName>, inferred_type: InferredType, ) -> Expr
pub fn number(big_decimal: BigDecimal) -> Expr
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Expr
impl Ord for Expr
Source§impl PartialOrd for Expr
impl PartialOrd for Expr
impl Eq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
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
Mutably borrows from an owned value. Read more
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
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request