Skip to main content

OpticProfile

Struct OpticProfile 

Source
pub struct OpticProfile {
    pub elevation_click: ClickValue,
    pub windage_click: ClickValue,
    pub clicks_per_revolution: Option<u32>,
    pub zero_stop: bool,
    pub elevation_travel: Option<TravelLimits>,
    pub windage_travel: Option<TravelLimits>,
    pub turret_state: Option<TurretState>,
    pub reticle_hold_bounds: Option<HoldBounds>,
}
Expand description

A shooter’s complete turret and reticle geometry (MBA-1348).

Every angular field anywhere in this type is in MIL. Turret-related fields (clicks_per_revolution, elevation_travel, windage_travel, turret_state) are in DIAL-space; reticle_hold_bounds is TRUE angular. See the module docs for what that distinction means and why it matters.

Fields§

§elevation_click: ClickValue

Elevation turret’s click graduation (its engraved size, e.g. 0.1 mil or 1/4 MOA). Serializes as crate::adjustment::ClickValue’s own suffixed string ("0.1mil"), not a structural object. validate requires a positive size.

§windage_click: ClickValue

Windage turret’s click graduation. Same serialized form and validate rule as elevation_click.

§clicks_per_revolution: Option<u32>

Click detents per full turret revolution, for turrets whose cap marks revolutions at all (many hunting turrets do not, hence Option). Must be at least 1 when present — Some(0) is rejected by validate, since a revolution with zero clicks in it is not a revolution.

§zero_stop: bool

Whether the elevation turret hard-stops at elevation_travel.down_mil, so the shooter cannot dial below zero at all. Descriptive metadata about the mechanism: validate does not require elevation_travel to be Some just because zero_stop is true, or vice versa.

§elevation_travel: Option<TravelLimits>

Elevation travel remaining in each direction from the current zero setting (not from the mechanical bottom of the turret) — DIAL-space, mil.

§windage_travel: Option<TravelLimits>

Windage travel from the current zero — DIAL-space, mil. down_mil is LEFT travel, up_mil is RIGHT travel (see TravelLimits).

§turret_state: Option<TurretState>

The turret’s current dialed offset from zero — DIAL-space, mil.

§reticle_hold_bounds: Option<HoldBounds>

The reticle’s usable hold extent — TRUE angular, mil. See HoldBounds: this is an EXPLICIT input and is never derived from a crate::reticle::ReticleDescription.

Implementations§

Source§

impl OpticProfile

Source

pub fn validate(&self) -> Result<(), OpticError>

Checks internal consistency: every angular field is finite, both click sizes are positive, every travel/hold-bound magnitude is non-negative, clicks_per_revolution is a sane count, and — when both are present — turret_state lies within elevation_travel / windage_travel.

This cannot and does not check that the profile matches any real, physical scope; it only rejects shapes that are self-contradictory or would corrupt downstream arithmetic (a zero-length revolution, NaN propagation, a dialed state the turret could not physically reach given its own declared travel, or a zero/negative click size that would turn a later quantize_angle division into infinity or NaN).

Trait Implementations§

Source§

impl Clone for OpticProfile

Source§

fn clone(&self) -> OpticProfile

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 OpticProfile

Source§

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

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

impl<'de> Deserialize<'de> for OpticProfile

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 PartialEq for OpticProfile

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for OpticProfile

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 OpticProfile

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