pub struct SuppliedCurves { /* private fields */ }Expand description
Thrust curves the caller supplies, each for the OpenRocket digest a <motor> records.
A .ork motor records a digest: OpenRocket’s fingerprint (a hash) of its curve’s data, which
“uniquely identifies the functional characteristics” of the curve (OpenRocket’s GitHub
wiki, file format 1.2), though OpenRocket 24.12’s own database holds a few digests that
two different motors share. Most designs do not embed the curve itself: OpenRocket finds it
in the motor database its program ships. hpr’s reader does no I/O and bundles only a small
catalog, so a caller holding such a database hands its curves in here: cargo xtask ork
supplies OpenRocket’s own, for the milestone that measured the design library’s curves
(M2.2c2).
A curve is used only for its own digest, never by name, which can match several curves. Supply
solid motors only: hpr flies commercial solid motors, and a SolidMotor carries no motor
type to refuse a hybrid by. A <motor> whose own <type> says hybrid is refused before any
curve is looked up.
Implementations§
Source§impl SuppliedCurves
impl SuppliedCurves
Sourcepub fn new(source: impl Into<String>) -> Self
pub fn new(source: impl Into<String>) -> Self
No curves yet, from source: words a reason can quote, such as OpenRocket 24.12's motor database.
Sourcepub fn insert(
&mut self,
digest: impl Into<String>,
case: CaseSize,
motor: SolidMotor,
) -> Result<Option<SolidMotor>, MotorError>
pub fn insert( &mut self, digest: impl Into<String>, case: CaseSize, motor: SolidMotor, ) -> Result<Option<SolidMotor>, MotorError>
Supplies motor, whose case is case, for digest; returns the motor it replaces, if any.
§Errors
MotorError::Domain when the case’s diameter or length is not finite and positive; the
curves are left as they were.
Sourcepub fn source(&self) -> &str
pub fn source(&self) -> &str
Where the curves came from, as given to SuppliedCurves::new; the supplied curves
when none was given.
Sourcepub fn get(&self, digest: &str) -> Option<&SolidMotor>
pub fn get(&self, digest: &str) -> Option<&SolidMotor>
The motor supplied for digest.
Trait Implementations§
Source§impl Clone for SuppliedCurves
impl Clone for SuppliedCurves
Source§fn clone(&self) -> SuppliedCurves
fn clone(&self) -> SuppliedCurves
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SuppliedCurves
impl Debug for SuppliedCurves
Source§impl Default for SuppliedCurves
impl Default for SuppliedCurves
Source§fn default() -> SuppliedCurves
fn default() -> SuppliedCurves
Source§impl<'de> Deserialize<'de> for SuppliedCurves
impl<'de> Deserialize<'de> for SuppliedCurves
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>,
Source§impl PartialEq for SuppliedCurves
impl PartialEq for SuppliedCurves
Source§fn eq(&self, other: &SuppliedCurves) -> bool
fn eq(&self, other: &SuppliedCurves) -> bool
self and other values to be equal, and is used by ==.