pub struct EvseIdParts {
pub country_code: String,
pub spot_operator: String,
pub power_outlet_id: String,
}Expand description
The parts of an EVSE ID that follows the eMI3/IDACS format.
Compliant with the following specification for EVSE ID: “E-mobility ID-codes: the purpose of IDs, ID usage and ID format”.
The format is <country code><spot operator><'E'><power outlet id>, with * optionally
separating the parts: NL*TNM*E1234 and NLTNME1234 are the same EVSE.
The evse_id field is only recommended to follow this format, so parsing is a query, never
a requirement: EvseIdParts::parse returns None for an ID in any other shape and the
crate carries on.
use ocpi_kit::types::EvseIdParts;
let parts = EvseIdParts::parse("NL*TNM*E1234").unwrap();
assert_eq!(parts.country_code, "NL");
assert_eq!(parts.spot_operator, "TNM");
assert_eq!(parts.power_outlet_id, "1234");
assert_eq!(EvseIdParts::parse("NLTNME1234").unwrap(), parts);
assert!(EvseIdParts::parse("some-internal-id").is_none());Fields§
§country_code: StringThe two-letter country code of the spot operator.
spot_operator: StringThe three-character spot operator ID.
power_outlet_id: StringThe power outlet ID: the part after the E type marker.
Implementations§
Source§impl EvseIdParts
impl EvseIdParts
Sourcepub fn parse(id: &str) -> Option<Self>
pub fn parse(id: &str) -> Option<Self>
Parses an eMI3/IDACS EVSE ID, or returns None if id is in another shape.
Sourcepub fn party(&self) -> Result<PartyRef, InvalidString>
pub fn party(&self) -> Result<PartyRef, InvalidString>
The party that operates this EVSE, according to the ID.
The spec warns that this need not be the OCPI party_id that pushed the object:
“A party implementing OCPI MAY push EVSE IDs with an eMI3/IDACS spot operator different
from the OCPI party_id.”
§Errors
Returns InvalidString if the parts are not valid CiStrings, which cannot happen for
a value that came out of EvseIdParts::parse.
Sourcepub fn to_separated(&self) -> String
pub fn to_separated(&self) -> String
Renders the ID in the separated form, NL*TNM*E1234.
Trait Implementations§
Source§impl Clone for EvseIdParts
impl Clone for EvseIdParts
Source§fn clone(&self) -> EvseIdParts
fn clone(&self) -> EvseIdParts
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EvseIdParts
impl Debug for EvseIdParts
impl Eq for EvseIdParts
Source§impl PartialEq for EvseIdParts
impl PartialEq for EvseIdParts
impl StructuralPartialEq for EvseIdParts
Auto Trait Implementations§
impl Freeze for EvseIdParts
impl RefUnwindSafe for EvseIdParts
impl Send for EvseIdParts
impl Sync for EvseIdParts
impl Unpin for EvseIdParts
impl UnsafeUnpin for EvseIdParts
impl UnwindSafe for EvseIdParts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.