litex/stmt/by_stmt/
fn_cart_tuple.rs1use crate::prelude::*;
2use std::fmt;
3
4#[derive(Clone)]
5pub struct ByFnSetAsSetStmt {
6 pub func: Obj,
7 pub fn_set: FnSet,
8 pub line_file: LineFile,
9}
10
11impl fmt::Display for ByFnSetAsSetStmt {
12 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13 write!(
14 f,
15 "{} {} {} {} {}{} {} {}{} {}",
16 BY, FN_LOWER_CASE, SET, AS, SET, COLON, self.func, FACT_PREFIX, IN, self.fn_set
17 )
18 }
19}
20
21impl ByFnSetAsSetStmt {
22 pub fn new(func: Obj, fn_set: FnSet, line_file: LineFile) -> Self {
23 ByFnSetAsSetStmt {
24 func,
25 fn_set,
26 line_file,
27 }
28 }
29}
30
31#[derive(Clone)]
33pub struct ByFnAsSetStmt {
34 pub function: Obj,
35 pub line_file: LineFile,
36}
37
38#[derive(Clone)]
40pub struct ByTupleAsSetStmt {
41 pub obj: Obj,
42 pub line_file: LineFile,
43}
44
45impl fmt::Display for ByFnAsSetStmt {
46 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
47 write!(
48 f,
49 "{} {} {} {}{} {}",
50 BY, FN_LOWER_CASE, AS, SET, COLON, self.function
51 )
52 }
53}
54
55impl ByFnAsSetStmt {
56 pub fn new(function: Obj, line_file: LineFile) -> Self {
57 ByFnAsSetStmt {
58 function,
59 line_file,
60 }
61 }
62}
63
64impl fmt::Display for ByTupleAsSetStmt {
65 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
66 write!(f, "{} {} {} {}{} {}", BY, TUPLE, AS, SET, COLON, self.obj)
67 }
68}
69
70impl ByTupleAsSetStmt {
71 pub fn new(obj: Obj, line_file: LineFile) -> Self {
72 ByTupleAsSetStmt { obj, line_file }
73 }
74}