pub struct PidRounding {
pub kind: PidRoundingKind,
pub digits: u8,
}Fields§
§kind: PidRoundingKind§digits: u8Implementations§
Source§impl PidRounding
impl PidRounding
pub fn validate(self) -> Result<(), PidRoundingError>
Sourcepub fn round_value(
self,
value: f32,
) -> Result<RoundedPidValue, PidRoundingError>
pub fn round_value( self, value: f32, ) -> Result<RoundedPidValue, PidRoundingError>
Rounds the stored f32 to nearest, with exact halfway cases away from zero.
Widening before scaling avoids overflow and false halfway cases from f32
multiplication. Calculations themselves are not changed.
Trait Implementations§
Source§impl Clone for PidRounding
impl Clone for PidRounding
Source§fn clone(&self) -> PidRounding
fn clone(&self) -> PidRounding
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 ComposeSchema for PidRounding
impl ComposeSchema for PidRounding
impl Copy for PidRounding
Source§impl Debug for PidRounding
impl Debug for PidRounding
Source§impl Default for PidRounding
impl Default for PidRounding
Source§impl<'de> Deserialize<'de> for PidRounding
impl<'de> Deserialize<'de> for PidRounding
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
impl Eq for PidRounding
Source§impl JsonSchema for PidRounding
impl JsonSchema for PidRounding
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for PidRounding
impl PartialEq for PidRounding
Source§impl Serialize for PidRounding
impl Serialize for PidRounding
impl StructuralPartialEq for PidRounding
Auto Trait Implementations§
impl Freeze for PidRounding
impl RefUnwindSafe for PidRounding
impl Send for PidRounding
impl Sync for PidRounding
impl Unpin for PidRounding
impl UnsafeUnpin for PidRounding
impl UnwindSafe for PidRounding
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.