Skip to main content

Part

Enum Part 

Source
#[non_exhaustive]
pub enum Part {
Show 14 variants NoseCone(NoseCone), BodyTube(BodyTube), Transition(Transition), InnerTube(InnerTube), CenteringRing(CenteringRing), FinSet(FinSet), TubeFinSet(TubeFinSet), LaunchLug(LaunchLug), RailButton(RailButton), PodSet(PodSet), MassComponent(MassComponent), Parachute(Parachute), Streamer(Streamer), ShockCord(ShockCord),
}
Expand description

A part in the tree. Serialized as an object with one key, the part’s kind.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NoseCone(NoseCone)

A nose cone (body component).

§

BodyTube(BodyTube)

A body tube (body component).

§

Transition(Transition)

A transition (body component).

§

InnerTube(InnerTube)

An inner tube (internal): a coupler, motor mount tube or engine block.

§

CenteringRing(CenteringRing)

A centering ring or bulkhead (internal).

§

FinSet(FinSet)

A fin set (external, on a body tube). Its axial extent is the root chord.

§

TubeFinSet(TubeFinSet)

Tube fins (external, on a body tube).

§

LaunchLug(LaunchLug)

Launch lugs (external, on a body tube). The extent covers the whole row.

§

RailButton(RailButton)

Rail buttons (external, on a body tube). The extent covers the whole row.

§

PodSet(PodSet)

Pods (external, on a body tube). Its children are the pod’s body components, which stack along the pod’s axis; its extent is theirs (Component::length_m).

§

MassComponent(MassComponent)

A mass component (internal).

§

Parachute(Parachute)

A parachute (internal).

§

Streamer(Streamer)

A streamer (internal).

§

ShockCord(ShockCord)

A shock cord (internal).

Implementations§

Source§

impl Part

Source

pub fn kind_name(&self) -> &'static str

The part’s kind, as serialized.

Source

pub fn is_body(&self) -> bool

Whether this is a body component: a nose cone, body tube or transition.

Source

pub fn is_external(&self) -> bool

Whether this attaches to the outside of a body tube: fins, tube fins, lugs, rail buttons, pods.

Source

pub fn length_m(&self) -> f64

The axial extent used to place the part, m: a body component’s length without shoulders, a fin set’s root chord, a row of lugs or buttons from the first one’s forward end to the last one’s aft end, and a packed part’s packed length. A pod set’s extent is its pods’ body components, which the part alone doesn’t hold, so here it is 0: see Component::length_m.

Source

pub fn packing(&self) -> Option<&Packing>

How a mass object or recovery part is packed, or None for a part that is not packed.

Source

pub fn fore_radius_m(&self) -> Option<f64>

A body component’s outer radius at its forward end, m (zero at a nose tip).

Source

pub fn aft_radius_m(&self) -> Option<f64>

A body component’s outer radius at its aft end, m.

Source

pub fn max_radius_m(&self) -> Result<Option<f64>, DesignError>

A body component’s largest outer radius anywhere along it, m.

§Errors

Profile errors for a nose cone or transition.

Source

pub fn inner_radius_m(&self) -> Option<f64>

The inside radius of a body tube or inner tube, m: where internal parts fit.

Source

pub fn axis_offset_m(&self) -> [f64; 2]

Where the part’s own axis crosses the x–y plane, [x, y] in body axes, m: an inner tube’s or packed part’s radial offset turned by its angle, and the body axis for every other part.

Source

pub fn outer_radius_about_axis_m(&self) -> Option<f64>

An internal part’s outer radius about its own axis, m: an inner tube’s or ring’s outer radius, or a packed part’s packed radius.

Source

pub fn reach_from_m(&self, axis: [f64; 2]) -> Option<f64>

How far an internal part reaches from axis ([x, y] in body axes, m): the distance between the two axes plus the part’s outer radius, for the farthest tube of a cluster.

Source

pub fn mass_properties( &self, body_radius_m: Option<f64>, ) -> Result<MassProperties, DesignError>

Mass properties in the part’s own frame. External attachments need the radius of the body they sit on.

§Errors

The part’s own geometry, material and numerical errors, and DesignError::Geometry when an external attachment has no body radius.

Trait Implementations§

Source§

impl Clone for Part

Source§

fn clone(&self) -> Part

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 Part

Source§

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

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

impl<'de> Deserialize<'de> for Part

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 Part

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 Part

Source§

fn eq(&self, other: &Part) -> 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 Part

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 Part

Auto Trait Implementations§

§

impl Freeze for Part

§

impl RefUnwindSafe for Part

§

impl Send for Part

§

impl Sync for Part

§

impl Unpin for Part

§

impl UnsafeUnpin for Part

§

impl UnwindSafe for Part

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.