Skip to main content

SettlePosition

Struct SettlePosition 

Source
pub struct SettlePosition {
    pub description: String,
    pub legal_basis: String,
    pub kwh: Decimal,
    pub rate_ct_kwh: Decimal,
    pub eur: Decimal,
}
Expand description

A single billing component of a settlement calculation.

Each position represents one regulatory charge line: net_eur = kwh × rate_ct_kwh / 100.

Convert to a billing::LineItem for invoice generation via .to_line_item().

Fields§

§description: String

Human-readable description of this charge line.

§legal_basis: String

Legal basis for audit trail (e.g. "§21 EEG 2023", "§23a EEG 2023 i.V.m. Anlage 1").

§kwh: Decimal

Energy quantity this position applies to (kWh).

§rate_ct_kwh: Decimal

Rate in ct/kWh. May be negative (e.g. PostEegSpot at negative EPEX).

§eur: Decimal

Net amount in EUR (kwh × rate_ct_kwh / 100, rounded to 5dp).

Positive = NB owes Anlagenbetreiber (typical). Negative = Anlagenbetreiber owes NB (post-EEG at negative EPEX).

Implementations§

Source§

impl SettlePosition

Source

pub fn to_line_item(&self) -> LineItem

Convert this position to a billing::LineItem for use in billing::BillingDocument generation (invoice, settlement receipt).

Uses billing::LineItem::for_usage() with the signed rate — negative EPEX prices produce a negative net_amount on a Sign::Debit item, correctly modelling the post-EEG scenario where the plant owes the NB.

Trait Implementations§

Source§

impl Clone for SettlePosition

Source§

fn clone(&self) -> SettlePosition

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 SettlePosition

Source§

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

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

impl Eq for SettlePosition

Source§

impl PartialEq for SettlePosition

Source§

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

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> 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 = !

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.