Struct umm::grade::Grade

source ·
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

source

pub fn new(grade: f64, out_of: f64) -> Self

Creates a new grade -

  • grade - The actual grade received
  • out_of - The maximum grade possible
source

pub fn grade_from_string(grade_string: String) -> Result<Grade>

Creates a new grade from a string -

  • grade_string - A string in the format grade/out_of, eg. 10/20
source

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.

source

pub fn grade(&mut self) -> f64

a getter for the grade

source

pub fn out_of(&mut self) -> f64

a getter for the out_of

source

pub fn set_grade(self, grade: f64) -> Self

a setter for the grade

source

pub fn set_out_of(self, out_of: f64) -> Self

a setter for the out_of

Trait Implementations§

source§

impl Clone for Grade

source§

fn clone(&self) -> Grade

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CustomType for Grade

Allows registering custom types with Rhai.

source§

fn build(builder: TypeBuilder<'_, Self>)

Builds the custom type for use with the [Engine]. Read more
source§

impl Default for Grade

source§

fn default() -> Grade

Returns the “default value” for a type. Read more
source§

impl Display for Grade

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into<'async_trait>( self ) -> Pin<Box<dyn Future<Output = Result<U, <U as TryFrom<T>>::Error>> + 'async_trait>>
where T: 'async_trait,

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more