Skip to main content

ResolvedHydroUnitGroupBounds

Struct ResolvedHydroUnitGroupBounds 

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

Pre-resolved per-(hydro unit group, stage, block) override table.

stage and block are independently lazy: each stays empty until a row actually resolves to a cell in that layer, so a study with no group-bound rows — or only unresolvable ones — leaves both empty regardless of how many groups hydros declares. is_empty reports exactly this.

§Examples

use cobre_core::resolved::ResolvedHydroUnitGroupBounds;

let empty = ResolvedHydroUnitGroupBounds::empty();
assert!(empty.is_empty());
assert_eq!(
    empty.override_at_block(0, 0, 0, 0),
    Default::default()
);

Implementations§

Source§

impl ResolvedHydroUnitGroupBounds

Source

pub fn empty() -> Self

Create an empty override table; every reader returns the column default and every writer returns None.

Source

pub fn new(spec: &HydroUnitGroupBoundsCountsSpec<'_>) -> Self

Allocate the group axis for a new override table. stage and block start empty — stage_override_mut and block_override_mut grow each to full size on its own first successful write, so a table with zero applied rows stays is_empty.

Source

pub fn stage_override( &self, hydro_idx: usize, group_pos: usize, stage_idx: usize, ) -> HydroUnitGroupOverride

Look up the stage-wide override at (hydro_idx, group_pos, stage_idx). Returns HydroUnitGroupOverride::default (all None) when the layer is empty or any index is out of range.

Source

pub fn stage_override_mut( &mut self, hydro_idx: usize, group_pos: usize, stage_idx: usize, ) -> Option<&mut HydroUnitGroupOverride>

Return a mutable handle to the stage-wide override cell, growing the layer to full size on its first call, or None when any index is out of range.

Source

pub fn block_override( &self, hydro_idx: usize, group_pos: usize, stage_idx: usize, block_idx: usize, ) -> HydroUnitGroupOverride

Look up the per-block override at (hydro_idx, group_pos, stage_idx, block_idx). Returns HydroUnitGroupOverride::default (all None) when the layer is empty or any index is out of range.

Source

pub fn block_override_mut( &mut self, hydro_idx: usize, group_pos: usize, stage_idx: usize, block_idx: usize, ) -> Option<&mut HydroUnitGroupOverride>

Return a mutable handle to the per-block override cell, growing the layer to full size on its first call, or None when any index is out of range.

Source

pub fn override_at_block( &self, hydro_idx: usize, group_pos: usize, stage_idx: usize, block_idx: usize, ) -> HydroUnitGroupOverride

Return the resolved override at (hydro_idx, group_pos, stage_idx, block_idx), applying the bound-precedence law column-independently: block.<col>.or(stage.<col>). A block row touching only one column never erases a stage-wide value on another column.

Source

pub fn is_empty(&self) -> bool

Returns true when both layers are empty — no row has ever resolved to a written cell.

Trait Implementations§

Source§

impl Clone for ResolvedHydroUnitGroupBounds

Source§

fn clone(&self) -> ResolvedHydroUnitGroupBounds

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 ResolvedHydroUnitGroupBounds

Source§

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

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

impl Default for ResolvedHydroUnitGroupBounds

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ResolvedHydroUnitGroupBounds

Source§

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

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