Skip to main content

ParamMeta

Struct ParamMeta 

Source
pub struct ParamMeta { /* private fields */ }
Expand description

What a ground station shows for one param: its description, unit, where it is grouped, and its valid range. Built from a per-group template:

use stable_flight::params::metadata::ParamMeta;

const LIMITS: ParamMeta = ParamMeta::in_group("Guidance", "Limits");
const TILT: ParamMeta = LIMITS
    .param("GUID_TILT_MAX", "Largest tilt waypoint flight may request")
    .with_units("deg")
    .above(0.0)
    .below(90.0);

assert_eq!(TILT.group(), "Limits");
assert!(!TILT.max().expect("bounded").inclusive());

Implementations§

Source§

impl ParamMeta

Source

pub const fn in_group(category: &'static str, group: &'static str) -> Self

A template for the params of one group (e.g. "Rate") within a category (the component, e.g. "Stabilizer"): no name, unit, or range yet. Name it with param.

Source

pub const fn param(self, name: &'static str, description: &'static str) -> Self

This template as the param name, described by a one-line description.

Source

pub const fn with_units(self, units: &'static str) -> Self

With units as a ground station shows them, e.g. "deg/s"; empty for a dimensionless param (gains, fractions).

Source

pub const fn at_least(self, value: f32) -> Self

Valid from value up, value included.

Source

pub const fn above(self, value: f32) -> Self

Valid above value, value excluded.

Source

pub const fn at_most(self, value: f32) -> Self

Valid up to value, value included.

Source

pub const fn below(self, value: f32) -> Self

Valid below value, value excluded.

Source

pub const fn name(&self) -> &'static str

The param’s name, as in its ParamTable.

Source

pub const fn description(&self) -> &'static str

One-line description.

Source

pub const fn units(&self) -> &'static str

Units, e.g. "deg/s"; empty when dimensionless.

Source

pub const fn category(&self) -> &'static str

The component the param belongs to, e.g. "Stabilizer".

Source

pub const fn group(&self) -> &'static str

The loop or feature within the component, e.g. "Rate".

Source

pub const fn min(&self) -> Option<Bound>

The lower end of the valid range; None when unbounded below.

Source

pub const fn max(&self) -> Option<Bound>

The upper end of the valid range; None when unbounded above.

Trait Implementations§

Source§

impl Clone for ParamMeta

Source§

fn clone(&self) -> Self

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 Copy for ParamMeta

Source§

impl Debug for ParamMeta

Source§

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

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

impl PartialEq for ParamMeta

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParamMeta

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.