pub enum IrOperation {
Show 38 variants
Literal {
variant: LiteralVariant,
value: Value,
ty: IrType,
evidence: IrEvidence,
},
Var {
name: String,
id: String,
ty: IrType,
evidence: IrEvidence,
},
Let {
pattern: IrPattern,
type_annotation: Option<IrType>,
init: Box<IrOperation>,
evidence: IrEvidence,
},
Binary {
operator: BinaryOp,
left: Box<IrOperation>,
right: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Unary {
operator: UnaryOp,
operand: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Call {
function: String,
function_id: String,
args: Vec<IrOperation>,
type_args: Vec<IrType>,
ty: IrType,
evidence: IrEvidence,
},
MethodCall {
receiver: Box<IrOperation>,
method: String,
args: Vec<IrOperation>,
type_args: Vec<IrType>,
ty: IrType,
evidence: IrEvidence,
},
Closure {
params: Vec<IrParam>,
body: Box<IrOperation>,
captures: Vec<String>,
ty: IrType,
evidence: IrEvidence,
},
If {
condition: Box<IrOperation>,
then_branch: Box<IrOperation>,
else_branch: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
Match {
scrutinee: Box<IrOperation>,
arms: Vec<IrMatchArm>,
ty: IrType,
evidence: IrEvidence,
},
LetMatch {
pattern: IrPattern,
value: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Loop {
variant: LoopVariant,
condition: Option<Box<IrOperation>>,
iterator: Option<IrForIterator>,
body: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Break {
value: Option<Box<IrOperation>>,
evidence: IrEvidence,
},
Continue {
evidence: IrEvidence,
},
Return {
value: Option<Box<IrOperation>>,
evidence: IrEvidence,
},
Block {
statements: Vec<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Pipeline {
input: Box<IrOperation>,
steps: Vec<IrPipelineStep>,
ty: IrType,
evidence: IrEvidence,
},
Morpheme {
morpheme: MorphemeKind,
symbol: String,
input: Box<IrOperation>,
body: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
Fork {
branches: Vec<IrOperation>,
join_strategy: JoinStrategy,
ty: IrType,
evidence: IrEvidence,
},
Identity {
ty: IrType,
evidence: IrEvidence,
},
Array {
elements: Vec<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Tuple {
elements: Vec<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
StructInit {
name: String,
fields: Vec<(String, IrOperation)>,
rest: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
Field {
expr: Box<IrOperation>,
field: String,
ty: IrType,
evidence: IrEvidence,
},
Index {
expr: Box<IrOperation>,
index: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Assign {
target: Box<IrOperation>,
value: Box<IrOperation>,
evidence: IrEvidence,
},
EvidenceCoerce {
operation: EvidenceOp,
expr: Box<IrOperation>,
from_evidence: IrEvidence,
to_evidence: IrEvidence,
ty: IrType,
},
Incorporation {
segments: Vec<IncorporationSegment>,
args: Vec<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Affect {
expr: Box<IrOperation>,
affect: IrAffect,
ty: IrType,
evidence: IrEvidence,
},
HttpRequest {
method: HttpMethod,
url: Box<IrOperation>,
headers: Option<Box<IrOperation>>,
body: Option<Box<IrOperation>>,
timeout: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
GrpcCall {
service: String,
method: String,
message: Box<IrOperation>,
metadata: Option<Box<IrOperation>>,
timeout: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
WebSocket {
operation: WebSocketOp,
url: Box<IrOperation>,
message: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
KafkaOp {
operation: KafkaOpKind,
topic: String,
payload: Option<Box<IrOperation>>,
key: Option<Box<IrOperation>>,
ty: IrType,
evidence: IrEvidence,
},
Await {
expr: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Unsafe {
body: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
Async {
body: Box<IrOperation>,
is_move: bool,
ty: IrType,
evidence: IrEvidence,
},
Cast {
expr: Box<IrOperation>,
target_type: IrType,
ty: IrType,
evidence: IrEvidence,
},
Try {
expr: Box<IrOperation>,
ty: IrType,
evidence: IrEvidence,
},
}Expand description
Core operation node - the heart of the IR
Variants§
Literal
Var
Let
Binary
Unary
Call
MethodCall
Closure
If
Fields
condition: Box<IrOperation>then_branch: Box<IrOperation>else_branch: Option<Box<IrOperation>>evidence: IrEvidenceMatch
LetMatch
Pattern match used as a boolean condition in if-let/while-let expressions. Returns true if the pattern matches, false otherwise. Pattern bindings are extracted in the then-branch.
Loop
Fields
variant: LoopVariantcondition: Option<Box<IrOperation>>iterator: Option<IrForIterator>body: Box<IrOperation>evidence: IrEvidenceBreak
Continue
Fields
evidence: IrEvidenceReturn
Block
Pipeline
Morpheme
Fields
morpheme: MorphemeKindinput: Box<IrOperation>body: Option<Box<IrOperation>>evidence: IrEvidenceFork
Identity
Array
Tuple
StructInit
Field
Index
Assign
EvidenceCoerce
Fields
operation: EvidenceOpexpr: Box<IrOperation>from_evidence: IrEvidenceto_evidence: IrEvidenceIncorporation
Affect
HttpRequest
Fields
method: HttpMethodurl: Box<IrOperation>headers: Option<Box<IrOperation>>body: Option<Box<IrOperation>>timeout: Option<Box<IrOperation>>evidence: IrEvidenceGrpcCall
Fields
message: Box<IrOperation>metadata: Option<Box<IrOperation>>timeout: Option<Box<IrOperation>>evidence: IrEvidenceWebSocket
Fields
operation: WebSocketOpurl: Box<IrOperation>message: Option<Box<IrOperation>>evidence: IrEvidenceKafkaOp
Fields
operation: KafkaOpKindpayload: Option<Box<IrOperation>>key: Option<Box<IrOperation>>evidence: IrEvidenceAwait
Unsafe
Async
Cast
Try
Trait Implementations§
Source§impl Clone for IrOperation
impl Clone for IrOperation
Source§fn clone(&self) -> IrOperation
fn clone(&self) -> IrOperation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IrOperation
impl Debug for IrOperation
Source§impl<'de> Deserialize<'de> for IrOperation
impl<'de> Deserialize<'de> for IrOperation
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>,
Auto Trait Implementations§
impl Freeze for IrOperation
impl RefUnwindSafe for IrOperation
impl Send for IrOperation
impl Sync for IrOperation
impl Unpin for IrOperation
impl UnwindSafe for IrOperation
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);