pub struct AggregateRating { /* private fields */ }Expand description
Aggregate rating primitive.
Implementations§
Source§impl AggregateRating
impl AggregateRating
Sourcepub fn new(
rating_value: f32,
review_count: u32,
) -> Result<Self, SchemaValueError>
pub fn new( rating_value: f32, review_count: u32, ) -> Result<Self, SchemaValueError>
Creates an aggregate rating.
§Errors
Returns SchemaValueError::InvalidRating when the value is outside 0.0..=5.0.
Sourcepub const fn schema_type(&self) -> &'static str
pub const fn schema_type(&self) -> &'static str
Returns the schema-like type label.
Sourcepub const fn rating_value(self) -> f32
pub const fn rating_value(self) -> f32
Returns the rating value.
Sourcepub const fn review_count(self) -> u32
pub const fn review_count(self) -> u32
Returns the review count.
Trait Implementations§
Source§impl Clone for AggregateRating
impl Clone for AggregateRating
Source§fn clone(&self) -> AggregateRating
fn clone(&self) -> AggregateRating
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 AggregateRating
impl Debug for AggregateRating
Source§impl PartialEq for AggregateRating
impl PartialEq for AggregateRating
Source§fn eq(&self, other: &AggregateRating) -> bool
fn eq(&self, other: &AggregateRating) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for AggregateRating
impl StructuralPartialEq for AggregateRating
Auto Trait Implementations§
impl Freeze for AggregateRating
impl RefUnwindSafe for AggregateRating
impl Send for AggregateRating
impl Sync for AggregateRating
impl Unpin for AggregateRating
impl UnsafeUnpin for AggregateRating
impl UnwindSafe for AggregateRating
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