diff options
| author | sam-anthony <samanthony6@protonmail.com> | 2022-02-04 17:04:49 -0330 |
|---|---|---|
| committer | sam-anthony <samanthony6@protonmail.com> | 2022-02-04 17:04:49 -0330 |
| commit | fd512094eb013e512c1faa98eb168bbc0b23859b (patch) | |
| tree | bfa688f482a67fc76e1cf6bba1867d0226dbb368 /src/input.rs | |
| parent | 36928f2351d0eb5fd27ccfe862f2cca21758f663 (diff) | |
| download | volute-fd512094eb013e512c1faa98eb168bbc0b23859b.zip | |
clean up
Diffstat (limited to 'src/input.rs')
| -rw-r--r-- | src/input.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/input.rs b/src/input.rs index f6b1459..513aef6 100644 --- a/src/input.rs +++ b/src/input.rs @@ -11,6 +11,7 @@ pub enum InputParam { Ve(String), // Volumetric efficiency Map(String), // Manifold absolute pressure } + impl InputParam { /* Acts like the push() method of a Vec. * Appends the given char to the end of the string contained by the @@ -32,6 +33,7 @@ impl InputParam { } } } + /* Acts like the pop() method of a Vec. * Removes the last char from the string contained by the InputParam. */ @@ -51,6 +53,7 @@ impl InputParam { } } } + // Return a copy of the string contained by the InputParam. pub fn string(&self) -> String { match self { @@ -59,6 +62,7 @@ impl InputParam { Self::Map(map) => map.to_string(), } } + /* next() and previous() allow InputParam to act as a circular iterator of * sorts. next() will return the next variation as they are defined. When * it reaches the end, the first variation will be returned: @@ -73,6 +77,7 @@ impl InputParam { Self::Map(_) => Self::Rpm(String::new()), } } + pub fn previous(&self) -> Self { match self { Self::Rpm(_) => Self::Map(String::new()), @@ -89,6 +94,7 @@ pub struct Row { pub ve: InputParam, pub map: InputParam, } + impl Default for Row { fn default() -> Self { Self { |