pub struct ResolvedExchangeFactors { /* private fields */ }Expand description
Pre-resolved per-block exchange capacity factors.
Provides O(1) lookup of exchange factors by (line_index, stage_index, block_index) returning (direct_factor, reverse_factor). Returns
(1.0, 1.0) for absent entries. Populated by cobre-io during the
resolution step and stored in crate::System.
§Examples
use cobre_core::resolved::ResolvedExchangeFactors;
let empty = ResolvedExchangeFactors::empty();
assert_eq!(empty.factors(0, 0, 0), (1.0, 1.0));Implementations§
Source§impl ResolvedExchangeFactors
impl ResolvedExchangeFactors
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create an empty exchange factors table. All lookups return (1.0, 1.0).
Used as the default when no exchange_factors.json exists.
§Examples
use cobre_core::resolved::ResolvedExchangeFactors;
let t = ResolvedExchangeFactors::empty();
assert_eq!(t.factors(5, 3, 2), (1.0, 1.0));Sourcepub fn new(n_lines: usize, n_stages: usize, max_blocks: usize) -> Self
pub fn new(n_lines: usize, n_stages: usize, max_blocks: usize) -> Self
Create a new exchange factors table with the given dimensions.
All entries are initialized to (1.0, 1.0) (no scaling). Use set
to populate individual entries.
Trait Implementations§
Source§impl Clone for ResolvedExchangeFactors
impl Clone for ResolvedExchangeFactors
Source§fn clone(&self) -> ResolvedExchangeFactors
fn clone(&self) -> ResolvedExchangeFactors
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResolvedExchangeFactors
impl Debug for ResolvedExchangeFactors
Source§impl PartialEq for ResolvedExchangeFactors
impl PartialEq for ResolvedExchangeFactors
impl StructuralPartialEq for ResolvedExchangeFactors
Auto Trait Implementations§
impl Freeze for ResolvedExchangeFactors
impl RefUnwindSafe for ResolvedExchangeFactors
impl Send for ResolvedExchangeFactors
impl Sync for ResolvedExchangeFactors
impl Unpin for ResolvedExchangeFactors
impl UnsafeUnpin for ResolvedExchangeFactors
impl UnwindSafe for ResolvedExchangeFactors
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more