1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
use crate::nodes::{ Block, Expression, }; #[derive(Clone, Debug, PartialEq, Eq)] pub struct NumericForStatement { identifier: String, start: Expression, end: Expression, step: Option<Expression>, block: Block, } impl NumericForStatement { pub fn new<S: Into<String>>( identifier: S, start: Expression, end: Expression, step: Option<Expression>, block: Block ) -> Self { Self { identifier: identifier.into(), start, end, step, block, } } #[inline] pub fn get_block(&self) -> &Block { &self.block } #[inline] pub fn mutate_block(&mut self) -> &mut Block { &mut self.block } #[inline] pub fn get_start(&self) -> &Expression { &self.start } #[inline] pub fn mutate_start(&mut self) -> &mut Expression { &mut self.start } #[inline] pub fn get_end(&self) -> &Expression { &self.end } #[inline] pub fn mutate_end(&mut self) -> &mut Expression { &mut self.end } #[inline] pub fn get_step(&self) -> Option<&Expression> { self.step.as_ref() } #[inline] pub fn mutate_step(&mut self) -> &mut Option<Expression> { &mut self.step } #[inline] pub fn get_identifier(&self) -> &String { &self.identifier } #[inline] pub fn mutate_identifier(&mut self) -> &mut String { &mut self.identifier } #[inline] pub fn set_identifier<S: Into<String>>(&mut self, identifier: S) { self.identifier = identifier.into(); } }