Skip to main content

CdrBuilder

Struct CdrBuilder 

Source
pub struct CdrBuilder<S: State = Empty> { /* private fields */ }
Available on crate feature v2_3_0 only.
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> CdrBuilder<S>

Source

pub fn build(self) -> Cdr
where S: IsComplete,

Finish building and return the requested object

Source

pub fn country_code( self, value: impl Into<CountryCode>, ) -> CdrBuilder<SetCountryCode<S>>
where S::CountryCode: IsUnset,

Required.

ISO-3166 alpha-2 country code of the CPO that ‘owns’ this CDR.

Source

pub fn party_id(self, value: impl Into<PartyId>) -> CdrBuilder<SetPartyId<S>>
where S::PartyId: IsUnset,

Required.

ID of the CPO that ‘owns’ this CDR.

Source

pub fn id(self, value: impl Into<CiString<39>>) -> CdrBuilder<SetId<S>>
where S::Id: IsUnset,

Required.

Uniquely identifies the CDR, unique per country_code/party_id combination.

Source

pub fn start_date_time( self, value: impl Into<DateTime>, ) -> CdrBuilder<SetStartDateTime<S>>
where S::StartDateTime: IsUnset,

Required.

Start of the charging session, or of the reservation when there was no session.

Source

pub fn end_date_time( self, value: impl Into<DateTime>, ) -> CdrBuilder<SetEndDateTime<S>>
where S::EndDateTime: IsUnset,

Required.

When the session was completed. Charging may have finished earlier.

Source

pub fn session_id( self, value: impl Into<CiString<36>>, ) -> CdrBuilder<SetSessionId<S>>
where S::SessionId: IsUnset,

Optional (Some / Option setters). The Session this CDR belongs to.

Is only allowed to be omitted when the CPO has not implemented the Sessions module or this CDR is the result of a reservation that never became a charging session.

Source

pub fn maybe_session_id( self, value: Option<impl Into<CiString<36>>>, ) -> CdrBuilder<SetSessionId<S>>
where S::SessionId: IsUnset,

Optional (Some / Option setters). The Session this CDR belongs to.

Is only allowed to be omitted when the CPO has not implemented the Sessions module or this CDR is the result of a reservation that never became a charging session.

Source

pub fn cdr_token(self, value: impl Into<CdrToken>) -> CdrBuilder<SetCdrToken<S>>
where S::CdrToken: IsUnset,

Required.

Token used to start this charging session.

Source

pub fn auth_method( self, value: impl Into<AuthMethod>, ) -> CdrBuilder<SetAuthMethod<S>>
where S::AuthMethod: IsUnset,

Required.

Method used for authentication. The last method used during the session.

Source

pub fn authorization_reference( self, value: impl Into<CiString<36>>, ) -> CdrBuilder<SetAuthorizationReference<S>>
where S::AuthorizationReference: IsUnset,

Optional (Some / Option setters). Reference to the authorization given by the eMSP.

Source

pub fn maybe_authorization_reference( self, value: Option<impl Into<CiString<36>>>, ) -> CdrBuilder<SetAuthorizationReference<S>>
where S::AuthorizationReference: IsUnset,

Optional (Some / Option setters). Reference to the authorization given by the eMSP.

Source

pub fn booking_id( self, value: impl Into<CiString<36>>, ) -> CdrBuilder<SetBookingId<S>>
where S::BookingId: IsUnset,

Optional (Some / Option setters). The Booking this CDR also belongs to.

Is only allowed to be omitted when the Session was reserved.

Added by the OCPI 2.3.0 bookings release branch, so it is behind the bookings feature.

Spec: 2.3.0-bookings §mod_cdrs_cdr_object

Source

pub fn maybe_booking_id( self, value: Option<impl Into<CiString<36>>>, ) -> CdrBuilder<SetBookingId<S>>
where S::BookingId: IsUnset,

Optional (Some / Option setters). The Booking this CDR also belongs to.

Is only allowed to be omitted when the Session was reserved.

Added by the OCPI 2.3.0 bookings release branch, so it is behind the bookings feature.

Spec: 2.3.0-bookings §mod_cdrs_cdr_object

Source

pub fn cdr_location( self, value: impl Into<CdrLocation>, ) -> CdrBuilder<SetCdrLocation<S>>
where S::CdrLocation: IsUnset,

Required.

Where the charging session took place.

Source

pub fn meter_id( self, value: impl Into<OcpiString<255>>, ) -> CdrBuilder<SetMeterId<S>>
where S::MeterId: IsUnset,

Optional (Some / Option setters). Identification of the meter inside the Charge Point.

Source

pub fn maybe_meter_id( self, value: Option<impl Into<OcpiString<255>>>, ) -> CdrBuilder<SetMeterId<S>>
where S::MeterId: IsUnset,

Optional (Some / Option setters). Identification of the meter inside the Charge Point.

Source

pub fn currency(self, value: impl Into<Currency>) -> CdrBuilder<SetCurrency<S>>
where S::Currency: IsUnset,

Required.

Currency of the CDR in ISO 4217 code.

Source

pub fn tariffs(self, value: impl Into<Vec<Tariff>>) -> CdrBuilder<SetTariffs<S>>
where S::Tariffs: IsUnset,

Optional (Some / Option setters). Default: <Vec<Tariff> as Default>::default().

Relevant Tariffs, as they were at the start of the session.

Source

pub fn maybe_tariffs( self, value: Option<impl Into<Vec<Tariff>>>, ) -> CdrBuilder<SetTariffs<S>>
where S::Tariffs: IsUnset,

Optional (Some / Option setters). Default: <Vec<Tariff> as Default>::default().

Relevant Tariffs, as they were at the start of the session.

Source

pub fn charging_periods( self, value: impl Into<Vec<ChargingPeriod>>, ) -> CdrBuilder<SetChargingPeriods<S>>
where S::ChargingPeriods: IsUnset,

Required.

Charging Periods that make up this session. Cardinality +.

Source

pub fn signed_data( self, value: impl Into<SignedData>, ) -> CdrBuilder<SetSignedData<S>>
where S::SignedData: IsUnset,

Optional (Some / Option setters). Signed metering data belonging to this session.

Source

pub fn maybe_signed_data( self, value: Option<impl Into<SignedData>>, ) -> CdrBuilder<SetSignedData<S>>
where S::SignedData: IsUnset,

Optional (Some / Option setters). Signed metering data belonging to this session.

Source

pub fn total_cost(self, value: impl Into<Price>) -> CdrBuilder<SetTotalCost<S>>
where S::TotalCost: IsUnset,

Required.

Total sum of all the costs of this transaction.

Source

pub fn total_fixed_cost( self, value: impl Into<Price>, ) -> CdrBuilder<SetTotalFixedCost<S>>
where S::TotalFixedCost: IsUnset,

Optional (Some / Option setters). Total of the fixed costs, except fixed price components of parking and reservation.

Source

pub fn maybe_total_fixed_cost( self, value: Option<impl Into<Price>>, ) -> CdrBuilder<SetTotalFixedCost<S>>
where S::TotalFixedCost: IsUnset,

Optional (Some / Option setters). Total of the fixed costs, except fixed price components of parking and reservation.

Source

pub fn total_energy( self, value: impl Into<Number>, ) -> CdrBuilder<SetTotalEnergy<S>>
where S::TotalEnergy: IsUnset,

Required.

Total energy charged, in kWh.

Source

pub fn total_energy_cost( self, value: impl Into<Price>, ) -> CdrBuilder<SetTotalEnergyCost<S>>
where S::TotalEnergyCost: IsUnset,

Optional (Some / Option setters). Total cost of all the energy used.

Source

pub fn maybe_total_energy_cost( self, value: Option<impl Into<Price>>, ) -> CdrBuilder<SetTotalEnergyCost<S>>
where S::TotalEnergyCost: IsUnset,

Optional (Some / Option setters). Total cost of all the energy used.

Source

pub fn total_time(self, value: impl Into<Number>) -> CdrBuilder<SetTotalTime<S>>
where S::TotalTime: IsUnset,

Required.

Total duration of the charging session, charging and not charging, in hours.

Source

pub fn total_time_cost( self, value: impl Into<Price>, ) -> CdrBuilder<SetTotalTimeCost<S>>
where S::TotalTimeCost: IsUnset,

Optional (Some / Option setters). Total cost related to the duration of charging.

Source

pub fn maybe_total_time_cost( self, value: Option<impl Into<Price>>, ) -> CdrBuilder<SetTotalTimeCost<S>>
where S::TotalTimeCost: IsUnset,

Optional (Some / Option setters). Total cost related to the duration of charging.

Source

pub fn total_parking_time( self, value: impl Into<Number>, ) -> CdrBuilder<SetTotalParkingTime<S>>
where S::TotalParkingTime: IsUnset,

Optional (Some / Option setters). Total duration during which the EV was not charging, in hours.

Source

pub fn maybe_total_parking_time( self, value: Option<impl Into<Number>>, ) -> CdrBuilder<SetTotalParkingTime<S>>
where S::TotalParkingTime: IsUnset,

Optional (Some / Option setters). Total duration during which the EV was not charging, in hours.

Source

pub fn total_parking_cost( self, value: impl Into<Price>, ) -> CdrBuilder<SetTotalParkingCost<S>>
where S::TotalParkingCost: IsUnset,

Optional (Some / Option setters). Total cost related to parking, including fixed price components.

Source

pub fn maybe_total_parking_cost( self, value: Option<impl Into<Price>>, ) -> CdrBuilder<SetTotalParkingCost<S>>
where S::TotalParkingCost: IsUnset,

Optional (Some / Option setters). Total cost related to parking, including fixed price components.

Source

pub fn total_reservation_cost( self, value: impl Into<Price>, ) -> CdrBuilder<SetTotalReservationCost<S>>
where S::TotalReservationCost: IsUnset,

Optional (Some / Option setters). Total cost related to a reservation, including fixed price components.

Source

pub fn maybe_total_reservation_cost( self, value: Option<impl Into<Price>>, ) -> CdrBuilder<SetTotalReservationCost<S>>
where S::TotalReservationCost: IsUnset,

Optional (Some / Option setters). Total cost related to a reservation, including fixed price components.

Source

pub fn remark( self, value: impl Into<OcpiString<255>>, ) -> CdrBuilder<SetRemark<S>>
where S::Remark: IsUnset,

Optional (Some / Option setters). Human-readable remark, e.g. the reason a transaction was stopped.

Source

pub fn maybe_remark( self, value: Option<impl Into<OcpiString<255>>>, ) -> CdrBuilder<SetRemark<S>>
where S::Remark: IsUnset,

Optional (Some / Option setters). Human-readable remark, e.g. the reason a transaction was stopped.

Source

pub fn invoice_reference_id( self, value: impl Into<CiString<39>>, ) -> CdrBuilder<SetInvoiceReferenceId<S>>
where S::InvoiceReferenceId: IsUnset,

Optional (Some / Option setters). Reference to an invoice that will later be sent for this CDR.

Source

pub fn maybe_invoice_reference_id( self, value: Option<impl Into<CiString<39>>>, ) -> CdrBuilder<SetInvoiceReferenceId<S>>
where S::InvoiceReferenceId: IsUnset,

Optional (Some / Option setters). Reference to an invoice that will later be sent for this CDR.

Source

pub fn credit(self, value: impl Into<bool>) -> CdrBuilder<SetCredit<S>>
where S::Credit: IsUnset,

Optional (Some / Option setters). Whether this is a Credit CDR. Requires credit_reference_id.

Source

pub fn maybe_credit( self, value: Option<impl Into<bool>>, ) -> CdrBuilder<SetCredit<S>>
where S::Credit: IsUnset,

Optional (Some / Option setters). Whether this is a Credit CDR. Requires credit_reference_id.

Source

pub fn credit_reference_id( self, value: impl Into<CiString<39>>, ) -> CdrBuilder<SetCreditReferenceId<S>>
where S::CreditReferenceId: IsUnset,

Optional (Some / Option setters). The id of the CDR this Credit CDR corrects.

Source

pub fn maybe_credit_reference_id( self, value: Option<impl Into<CiString<39>>>, ) -> CdrBuilder<SetCreditReferenceId<S>>
where S::CreditReferenceId: IsUnset,

Optional (Some / Option setters). The id of the CDR this Credit CDR corrects.

Source

pub fn home_charging_compensation( self, value: impl Into<bool>, ) -> CdrBuilder<SetHomeChargingCompensation<S>>
where S::HomeChargingCompensation: IsUnset,

Optional (Some / Option setters). Whether the energy cost of this home-charging session is compensated to the EV driver.

Source

pub fn maybe_home_charging_compensation( self, value: Option<impl Into<bool>>, ) -> CdrBuilder<SetHomeChargingCompensation<S>>
where S::HomeChargingCompensation: IsUnset,

Optional (Some / Option setters). Whether the energy cost of this home-charging session is compensated to the EV driver.

Source

pub fn last_updated( self, value: impl Into<DateTime>, ) -> CdrBuilder<SetLastUpdated<S>>
where S::LastUpdated: IsUnset,

Required.

Timestamp when this CDR was last updated (or created).

Source

pub fn extensions( self, value: impl Into<Extensions>, ) -> CdrBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters). Default: <Extensions as Default>::default().

Undocumented JSON fields, preserved verbatim.

Source

pub fn maybe_extensions( self, value: Option<impl Into<Extensions>>, ) -> CdrBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters). Default: <Extensions as Default>::default().

Undocumented JSON fields, preserved verbatim.

Auto Trait Implementations§

§

impl<S> Freeze for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: Freeze,

§

impl<S> RefUnwindSafe for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: RefUnwindSafe,

§

impl<S> Send for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: Send,

§

impl<S> Sync for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: Sync,

§

impl<S> Unpin for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: Unpin,

§

impl<S> UnsafeUnpin for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: UnsafeUnpin,

§

impl<S> UnwindSafe for CdrBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Cdr>)>: UnwindSafe,

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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, <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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more