Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct Relation {
- expr: Expression,
- operator: Operator,
- range_list: Vec<RangeListItem>,
- }
- #[derive(Debug)]
- struct Operator(char);
- #[derive(Debug)]
- struct Expression {
- operand: Operand,
- operation: Option<Operation>
- }
- #[derive(Debug)]
- struct Operation {
- operation_type: OperationType,
- value: Value
- }
- #[derive(Debug)]
- enum OperationType {
- MOD,
- PERCENT,
- }
- #[derive(Debug)]
- struct Operand(char);
- #[derive(Debug)]
- enum RangeListItem{
- Range(Range),
- Value(Value),
- }
- #[derive(Debug)]
- struct Value(usize);
- #[derive(Debug)]
- struct Range {
- from: Value,
- to: Value
- }
- fn main() {
- let cond = Relation {
- expr: Expression {
- operand: Operand('i'),
- operation: None,
- },
- operator: Operator('='),
- range_list: vec![
- RangeListItem::Value(Value(1)),
- ],
- };
- println!("{:#?}", cond);
- }
Add Comment
Please, Sign In to add comment