Skip to main content

Profile

Struct Profile 

Source
pub struct Profile {
    pub id: i32,
    pub stack_level: i32,
    pub purpose: Purpose,
    pub kind: ProfileKind,
    pub recurrency: Option<Recurrency>,
    pub valid_from: Option<DateTime>,
    pub valid_to: Option<DateTime>,
    pub transaction_id: Option<String>,
    pub evse_id: u32,
    pub schedules: Vec<Schedule>,
}
Expand description

A charging profile as installed by SetChargingProfile.

Fields§

§id: i32

chargingProfileId.

§stack_level: i32

Higher wins within a purpose.

§purpose: Purpose

What the profile is for.

§kind: ProfileKind

How its schedule is anchored.

§recurrency: Option<Recurrency>

How often it repeats, for Recurring.

§valid_from: Option<DateTime>

Not in effect before this instant.

§valid_to: Option<DateTime>

Not in effect after this instant.

§transaction_id: Option<String>

The transaction a TxProfile belongs to.

§evse_id: u32

The EVSE it was installed on; 0 means the whole Charging Station.

§schedules: Vec<Schedule>

Its schedules. Only the first is used by the composite calculation, as 1.6 and the common 2.x case have exactly one.

Implementations§

Source§

impl Profile

Source

pub fn to_v1_6(&self) -> Result<ChargingProfile, ConversionError>

This profile as an OCPP 1.6 ChargingProfile.

§Errors

ConversionError for a transaction id that is not an integer, a purpose 1.6 lacks, anything but exactly one schedule, a phaseToUse, or a number out of range.

Source

pub fn set_request_v1_6( &self, ) -> Result<SetChargingProfileRequest, ConversionError>

This profile as an OCPP 1.6 SetChargingProfile.req, for connector evse_id.

§Errors

As to_v1_6, and for a connector id out of range.

Source

pub fn from_v1_6( wire: &ChargingProfile, connector_id: u32, ) -> Result<Self, ConversionError>

A profile received in an OCPP 1.6 SetChargingProfile.req for connector_id.

1.6 schedules carry no id; the domain schedule takes the profile’s.

§Errors

ConversionError for an enumeration value 1.6 does not define.

Source§

impl Profile

Source

pub fn to_v2_0_1(&self) -> Result<ChargingProfile, ConversionError>

This profile as an OCPP v2_0_1 ChargingProfile.

§Errors

ConversionError for a purpose the version lacks, no schedule, or a number out of range.

Source

pub fn set_request_v2_0_1( &self, ) -> Result<SetChargingProfileRequest, ConversionError>

This profile as an OCPP v2_0_1 SetChargingProfileRequest for EVSE evse_id.

§Errors

As to_v2_0_1, and for an EVSE id out of range.

Source

pub fn from_v2_0_1( wire: &ChargingProfile, evse_id: u32, ) -> Result<Self, ConversionError>

A profile received in an OCPP v2_0_1 SetChargingProfileRequest for evse_id.

§Errors

ConversionError for anything that is not a plain ceiling — see its documentation for the list.

Source§

impl Profile

Source

pub fn to_v2_1(&self) -> Result<ChargingProfile, ConversionError>

This profile as an OCPP v2_1 ChargingProfile.

§Errors

ConversionError for a purpose the version lacks, no schedule, or a number out of range.

Source

pub fn set_request_v2_1( &self, ) -> Result<SetChargingProfileRequest, ConversionError>

This profile as an OCPP v2_1 SetChargingProfileRequest for EVSE evse_id.

§Errors

As to_v2_1, and for an EVSE id out of range.

Source

pub fn from_v2_1( wire: &ChargingProfile, evse_id: u32, ) -> Result<Self, ConversionError>

A profile received in an OCPP v2_1 SetChargingProfileRequest for evse_id.

§Errors

ConversionError for anything that is not a plain ceiling — see its documentation for the list.

Source§

impl Profile

Source

pub fn new( id: i32, stack_level: i32, purpose: Purpose, kind: ProfileKind, schedule: Schedule, ) -> Self

A profile with one schedule.

Source

pub fn on_evse(self, evse_id: u32) -> Self

Installs the profile on one EVSE.

Source

pub fn for_transaction(self, transaction_id: impl Into<String>) -> Self

Binds the profile to one transaction.

Source

pub fn valid(self, from: Option<DateTime>, to: Option<DateTime>) -> Self

Sets the validity window.

Source

pub fn recurring(self, recurrency: Recurrency) -> Self

Makes the profile repeat.

Trait Implementations§

Source§

impl Clone for Profile

Source§

fn clone(&self) -> Self

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 Profile

Source§

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

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

impl PartialEq for Profile

Source§

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

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

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.