pub struct Grade {
pub grade: f64,
pub out_of: f64,
}
Expand description
A struct representing a grade
Fields§
§grade: f64
The actual grade received
out_of: f64
The maximum grade possible
Implementations§
source§impl Grade
impl Grade
sourcepub fn new(grade: f64, out_of: f64) -> Self
pub fn new(grade: f64, out_of: f64) -> Self
Creates a new grade -
grade
- The actual grade receivedout_of
- The maximum grade possible
sourcepub fn grade_from_string(grade_string: String) -> Result<Grade>
pub fn grade_from_string(grade_string: String) -> Result<Grade>
Creates a new grade from a string -
grade_string
- A string in the formatgrade/out_of
, eg.10/20
sourcepub fn grade_from_string_script(
grade_string: String
) -> Result<Grade, Box<EvalAltResult>>
pub fn grade_from_string_script( grade_string: String ) -> Result<Grade, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
sourcepub fn set_out_of(self, out_of: f64) -> Self
pub fn set_out_of(self, out_of: f64) -> Self
a setter for the out_of
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Grade
impl Send for Grade
impl Sync for Grade
impl Unpin for Grade
impl UnwindSafe for Grade
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
Mutably borrows from an owned value. Read more