Skip to main content

Rocket

Struct Rocket 

Source
pub struct Rocket {
    pub name: String,
    pub stages: Vec<Stage>,
    pub reference_diameter: ReferenceDiameter,
    pub configurations: Vec<Configuration>,
}
Expand description

A rocket design: its stages, how its reference diameter is chosen, and its motor configurations.

Fields§

§name: String

Name.

§stages: Vec<Stage>

Stages from the nose aft. The first holds the nose cone. A parallel stage comes after the stage it hangs on (Stage::parallel).

§reference_diameter: ReferenceDiameter

How the reference diameter is chosen.

§configurations: Vec<Configuration>

Motor configurations.

Implementations§

Source§

impl Rocket

Source

pub fn configuration(&self, id: &str) -> Option<&Configuration>

The configuration with id id.

Source

pub fn check_configuration_ids(&self) -> Result<(), DesignError>

Checks that configuration ids are unique and non-empty.

§Errors

DesignError::DuplicateId for the first empty or repeated id.

Source

pub fn assemble(&self, configuration_id: &str) -> Result<Assembly, DesignError>

Resolves the tree and places the motors of configuration configuration_id.

§Errors
Source

pub fn lay_out(&self) -> Result<LaidOut, DesignError>

Lays the design out once (Rocket::layout), to check it (LaidOut::check) and assemble it (LaidOut::into_assembly) without laying it out again: the layout is most of the cost of either, and a Monte Carlo run builds a flight thousands of times.

§Errors

As Rocket::check_configuration_ids and Rocket::layout.

Source§

impl Rocket

Source

pub fn layout(&self) -> Result<Layout, DesignError>

Resolves the tree: checks its structure, fills in automatic dimensions, places every part, and computes the mass properties with overrides.

§Errors
  • DesignError::DuplicateId for an empty or repeated stage or component id.
  • DesignError::Tree for a rocket with no stages, an empty stage, a part in the wrong place (an attached part in a stage’s list, a body component attached anywhere but in a pod set, anything else in a pod set, fins or pods on anything but a body tube, a pod set in a pod, children under anything but a body component, inner tube or pod set), a pod set with an override that doesn’t cover its pods, a missing or unexpected position, an automatic dimension that doesn’t apply or can’t be resolved, or a motor mount on anything but a body tube or inner tube.
  • DesignError::Domain for a pod set of no pods or more than PodSet::MAX_COUNT, a radial offset or angle out of range, or a body component of no length in a stage.
  • Any part’s geometry, material or numerical error, a custom finish’s negative or non-finite roughness, and override errors.
Source

pub fn unresolvable_body_radii(&self) -> Vec<UnresolvableRadius>

The automatic body radii that layout cannot resolve, forward to aft.

These are the radii on a chain of automatic radii with no fixed radius anywhere along it: a nose cone whose base looks back at a tube that looks forward at it, or a stage of tubes that all say “automatic”. Neighbours are followed by the rule each AutoDimension documents. layout refuses a design for which this list is not empty; what such a radius should be is not in the design, so an importer that knows its source program’s convention fills them in first (fill_unresolvable_body_radii).

A parallel stage’s body components are not listed: they take their radii from one another, as a pod’s do, and layout refuses one it can’t resolve.

Only the body components’ own radii are listed. An automatic shoulder with no body tube beside it, or an automatic dimension a part does not have, is refused by layout with its own error instead.

Source

pub fn fill_unresolvable_body_radii( &mut self, radius_m: f64, ) -> Vec<UnresolvableRadius>

Gives every radius unresolvable_body_radii lists the fixed radius radius_m, drops its automatic mark, and returns what it filled.

Every radius on such a chain is listed, so the whole chain takes the one radius. Radii the neighbour rule could already reach are left as they are and resolve as before. The design no longer records that the filled radii were automatic, which is the point: it now says what they are.

Trait Implementations§

Source§

impl Clone for Rocket

Source§

fn clone(&self) -> Rocket

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Rocket

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Rocket

Source§

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 JsonSchema for Rocket

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

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

Generates a JSON Schema for this type. Read more
Source§

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 more
Source§

impl PartialEq for Rocket

Source§

fn eq(&self, other: &Rocket) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Rocket

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Rocket

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.