Skip to main content

SessionBuilder

Struct SessionBuilder 

Source
pub struct SessionBuilder<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> SessionBuilder<S>

Source

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

Finish building and return the requested object

Source

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

Required.

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

Source

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

Required.

ID of the CPO that ‘owns’ this Session.

Source

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

Required.

The unique id that identifies the charging session in the CPO platform.

Source

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

Required.

When the session became ACTIVE in the Charge Point.

When the session is still PENDING, this field SHALL be set to the time the Session was created at the Charge Point. When a Session goes from PENDING to ACTIVE, this field SHALL be updated to the moment the Session went to ACTIVE.

Source

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

Optional (Some / Option setters). When the session was completed. Charging may have finished earlier.

Source

pub fn maybe_end_date_time( self, value: Option<impl Into<DateTime>>, ) -> SessionBuilder<SetEndDateTime<S>>
where S::EndDateTime: IsUnset,

Optional (Some / Option setters). When the session was completed. Charging may have finished earlier.

Source

pub fn kwh(self, value: impl Into<Number>) -> SessionBuilder<SetKwh<S>>
where S::Kwh: IsUnset,

Required.

How many kWh were charged.

Source

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

Required.

Token used to start this charging session.

Source

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

Required.

Method used for authentication. This might change during a session.

Source

pub fn authorization_reference( self, value: impl Into<CiString<36>>, ) -> SessionBuilder<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>>>, ) -> SessionBuilder<SetAuthorizationReference<S>>
where S::AuthorizationReference: IsUnset,

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

Source

pub fn location_id( self, value: impl Into<CiString<36>>, ) -> SessionBuilder<SetLocationId<S>>
where S::LocationId: IsUnset,

Required.

Location.id on which the charging session is or was happening.

Source

pub fn evse_uid( self, value: impl Into<CiString<36>>, ) -> SessionBuilder<SetEvseUid<S>>
where S::EvseUid: IsUnset,

Required.

EVSE.uid on which the charging session is or was happening.

Allowed to be set to #NA when this session is created for a reservation, but no EVSE yet assigned to the driver.

Source

pub fn connector_id( self, value: impl Into<CiString<36>>, ) -> SessionBuilder<SetConnectorId<S>>
where S::ConnectorId: IsUnset,

Required.

Connector.id where the charging session is or was happening. May be #NA.

Source

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

Optional (Some / Option setters). Optional identification of the kWh meter.

Source

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

Optional (Some / Option setters). Optional identification of the kWh meter.

Source

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

Required.

ISO 4217 code of the currency used for this session.

Source

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

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

Charging Periods that can be used to calculate and verify the total cost.

Source

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

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

Charging Periods that can be used to calculate and verify the total cost.

Source

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

Optional (Some / Option setters). The total cost of the session.

A total_cost of 0.00 means free of charge. When omitted … it does not imply the session is/was free of charge.

Source

pub fn maybe_total_cost( self, value: Option<impl Into<Price>>, ) -> SessionBuilder<SetTotalCost<S>>
where S::TotalCost: IsUnset,

Optional (Some / Option setters). The total cost of the session.

A total_cost of 0.00 means free of charge. When omitted … it does not imply the session is/was free of charge.

Source

pub fn status( self, value: impl Into<SessionStatus>, ) -> SessionBuilder<SetStatus<S>>
where S::Status: IsUnset,

Required.

The status of the session.

Source

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

Required.

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

Source

pub fn extensions( self, value: impl Into<Extensions>, ) -> SessionBuilder<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>>, ) -> SessionBuilder<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 SessionBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Session>)>: Freeze,

§

impl<S> RefUnwindSafe for SessionBuilder<S>

§

impl<S> Send for SessionBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Session>)>: Send,

§

impl<S> Sync for SessionBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Session>)>: Sync,

§

impl<S> Unpin for SessionBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Session>)>: Unpin,

§

impl<S> UnsafeUnpin for SessionBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Session>)>: UnsafeUnpin,

§

impl<S> UnwindSafe for SessionBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<Session>)>: 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