pub struct RatingScale {
pub min: f64,
pub max: f64,
pub allow_ties: bool,
pub step: Option<f64>,
}Expand description
Rating scale configuration for numeric ratings
Defines the valid range and behavior for user ratings.
Fields§
§min: f64Minimum rating value
max: f64Maximum rating value
allow_ties: boolWhether ties are allowed (for pairwise comparisons)
step: Option<f64>Optional step size (e.g., 0.5 for half-star ratings)
Implementations§
Source§impl RatingScale
impl RatingScale
Sourcepub fn one_to_ten() -> Self
pub fn one_to_ten() -> Self
Standard 1-10 rating scale
Sourcepub fn one_to_five() -> Self
pub fn one_to_five() -> Self
Standard 1-5 rating scale (5-star rating)
Sourcepub fn denormalize(&self, normalized: f64) -> f64
pub fn denormalize(&self, normalized: f64) -> f64
Denormalize a [0, 1] value to this scale
Trait Implementations§
Source§impl Clone for RatingScale
impl Clone for RatingScale
Source§fn clone(&self) -> RatingScale
fn clone(&self) -> RatingScale
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RatingScale
impl Debug for RatingScale
Source§impl Default for RatingScale
impl Default for RatingScale
Source§impl<'de> Deserialize<'de> for RatingScale
impl<'de> Deserialize<'de> for RatingScale
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RatingScale
impl PartialEq for RatingScale
Source§impl Serialize for RatingScale
impl Serialize for RatingScale
impl StructuralPartialEq for RatingScale
Auto Trait Implementations§
impl Freeze for RatingScale
impl RefUnwindSafe for RatingScale
impl Send for RatingScale
impl Sync for RatingScale
impl Unpin for RatingScale
impl UnsafeUnpin for RatingScale
impl UnwindSafe for RatingScale
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.