Skip to main content

ModuleId

Enum ModuleId 

Source
#[non_exhaustive]
pub enum ModuleId {
Show 14 variants Cdrs, ChargingProfiles, Commands, Credentials, HubClientInfo, Locations, Payments, Sessions, Tariffs, Tokens, Versions, Booking, InvoiceReconciliation, Custom(String),
}
Expand description

The identifier of an OCPI module, as used in Endpoint.identifier.

Parties are allowed to create custom modules or customized versions of the existing modules. To do so, the ModuleID enum can be extended with additional custom moduleIDs. … It is advised to use a prefix (e.g. country-code + party-id) for any custom moduleID.

So ModuleId::Custom("nltnm-tokens") is a legitimate value, not an error.

Spec: 2.3.0 §version_information_endpoint_moduleid_enum

This is an OCPI OpenEnum: a value this version of the specification does not define is a legitimate extension, and Validate does not report it.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Cdrs

Charge Detail Records. Sender: CPO.

Wire value: cdrs

§

ChargingProfiles

Smart charging profiles.

Wire value: chargingprofiles

§

Commands

Remote commands: start, stop, reserve, unlock.

Wire value: commands

§

Credentials

Credentials and registration. Required for all implementations.

Wire value: credentials

§

HubClientInfo

Hub client info: which parties a hub has connected.

Wire value: hubclientinfo

§

Locations

Charging locations, EVSEs and connectors. Sender: CPO.

Wire value: locations

§

Payments

Payment terminals and financial advice confirmations. Sender: PTP.

Added to the protocol in OCPI 2.3.0.

Spec erratum. The Payments module chapter gives “Module Identifier: payments, but the module is missing from the ModuleID table in §version_information_endpoint_moduleid_enum of the same release. The chapter is normative for its own identifier, so payments is treated as a known module here.

Wire value: payments

§

Sessions

Charging sessions. Sender: CPO.

Wire value: sessions

§

Tariffs

Tariffs. Sender: CPO.

Wire value: tariffs

§

Tokens

Driver tokens and real-time authorization. Sender: eMSP.

Wire value: tokens

§

Versions

Versions and version details. Every implementation has this, but it is not listed as an endpoint inside version details.

Wire value: versions

§

Booking

Bookings, from the OCPI 2.3.0 bookings release branch.

Spec quirk. The identifier really is Booking: singular, and the only module ID in OCPI that is not lower-case. Every other module uses a lower-case plural. It is also absent from that branch’s ModuleID table. Peers that guessed bookings exist; see ModuleId::matches.

Wire value: Booking

§

InvoiceReconciliation

Invoice reconciliation, from the OCPI 2.3.0 payments release branch.

Wire value: invoicereconciliation

§

Custom(String)

A value this version of the specification does not define, preserved verbatim.

The variant is named Custom rather than Other because several OCPI OpenEnums have a defined value that is literally OTHER.

Implementations§

Source§

impl ModuleId

Source

pub const ALL_KNOWN: &'static [Self]

Every value this version of the specification defines, in declaration order.

Source

pub const ALL_KNOWN_WIRE: &'static [&'static str]

Every wire value this version of the specification defines.

Source

pub fn as_str(&self) -> &str

The value as it appears on the wire.

Source

pub const fn is_known(&self) -> bool

Whether this is a value the specification defines.

Source

pub fn from_str_ignore_case(s: &str) -> Self

Parses a wire value, ignoring ASCII case for the known values.

For peers that get the case wrong; FromStr is strict.

Source§

impl ModuleId

Source

pub const fn is_functional(&self) -> bool

Whether this module carries the message routing headers.

Only requests/responses from Function Modules … SHALL be routed, so need the routing headers. The requests/responses to/from Configuration Modules: Credentials, Versions and Hub Client Info are not to be routed … Thus routing headers SHALL NOT be used with these modules.

A custom module is assumed to be functional, since that is what a party would define one for.

Spec: 2.3.0 §transport_and_format_message_routing

Source

pub const fn is_configuration(&self) -> bool

Whether this is one of the three configuration modules, which are never routed.

Spec: 2.3.0 §transport_and_format_message_routing

Source

pub fn matches(&self, other: &Self) -> bool

Compares module identifiers the way a tolerant peer would.

Two accommodations, both narrow and both deliberate:

  • ASCII case is ignored. Module identifiers are lower-case everywhere except Booking, so a peer that lower-cased the lot is still understood.
  • Booking and bookings are treated as the same module. The Bookings chapter gives “Module Identifier: Booking — singular, and the only mixed-case identifier in OCPI — while implementations that assumed the lower-case plural exist. Getting this wrong means silently not discovering the module, which is worse than accepting both.

Use this when reading a peer’s version details; use == when the exact value matters.

Source

pub fn is_supported(&self) -> bool

Whether this build of ocpi-kit has a wire model for this module.

Source

pub fn exists_in(&self, version: &VersionNumber) -> bool

Whether the module exists in version.

Spec: 2.2.1 and 2.3.0 §version_information_endpoint_moduleid_enum; 2.1.1 §version_information_endpoint (which has neither hubclientinfo nor chargingprofiles).

Trait Implementations§

Source§

impl Clone for ModuleId

Source§

fn clone(&self) -> ModuleId

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 ModuleId

Source§

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

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

impl<'de> Deserialize<'de> for ModuleId

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ModuleId

Source§

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

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

impl Eq for ModuleId

Source§

impl From<&str> for ModuleId

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl FromStr for ModuleId

Source§

type Err = !

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for ModuleId

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl JsonSchema for ModuleId

Available on crate feature schema only.
Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn json_schema(_g: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

impl Ord for ModuleId

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for ModuleId

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 PartialOrd for ModuleId

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for ModuleId

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Validate for ModuleId

Source§

fn validate_in(&self, v: &mut Validator)

Appends this value’s violations to v, relative to v’s current position.
Source§

fn validate(&self) -> Result<(), Violations>

Validates this value as the root of an object graph. Read more

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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