#[non_exhaustive]pub enum Code {
Show 32 variants
Success,
HubjectSystemError,
HubjectDatabaseError,
DataTransactionError,
UnauthorizedAccess,
InconsistentEvseId,
InconsistentEvcoId,
SystemError,
DataError,
QrCodeAuthenticationFailed,
RfidInvalidUid,
RfidCardNotReadable,
PlcInvalidEvcoId,
NoPositiveAuthenticationResponse,
QrCodeAppTimeout,
PlcInvalidUnderlyingEvcoId,
PlcInvalidCertificate,
PlcTimeout,
EvcoIdLocked,
NoValidContract,
PartnerNotFound,
PartnerDidNotRespond,
ServiceNotAvailable,
SessionIsInvalid,
CommunicationToEvseFailed,
NoEvConnectedToEvse,
EvseAlreadyReserved,
EvseAlreadyInUse,
UnknownEvseId,
EvseIdNotHubjectCompatible,
EvseOutOfService,
Custom(String),
}Expand description
One of the status codes OICP 2.3 defines, or a code this crate has not seen.
The specification gives these as a table of three-digit strings in the StatusCode.Code
description. They are the only machine-readable signal a partner gets about why an operation
failed, so this crate makes them a type rather than a string: the semantics —
is this retryable?, is this an authorization
failure? — are encoded once, from the spec table, instead of
being re-derived (and got wrong) at every call site.
A code Hubject adds later lands in Code::Custom and is preserved, like every other open
value in this crate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Success
000 — Success. (General)
HubjectSystemError
001 — Hubject system error. (Internal system)
HubjectDatabaseError
002 — Hubject database error. (Internal system)
DataTransactionError
009 — Data transaction error. (Internal system)
017 — Unauthorized Access. (Internal system)
In practice this almost always means the OperatorID/ProviderID in the URL does not
match the TLS client certificate Hubject sees. See
ClientIdentity, which catches the mismatch locally.
InconsistentEvseId
018 — Inconsistent EvseID. (Internal system)
InconsistentEvcoId
019 — Inconsistent EvcoID. (Internal system)
SystemError
021 — System error. (General)
DataError
022 — Data error. (General)
QrCodeAuthenticationFailed
101 — QR Code Authentication failed – Invalid Credentials. (Authentication)
RfidInvalidUid
102 — RFID Authentication failed – invalid UID. (Authentication)
RfidCardNotReadable
103 — RFID Authentication failed – card not readable. (Authentication)
PlcInvalidEvcoId
105 — PLC Authentication failed - invalid EvcoID. (Authentication)
NoPositiveAuthenticationResponse
106 — No positive authentication response. (Authentication / Internal system)
QrCodeAppTimeout
110 — QR Code App Authentication failed – time out error. (Authentication)
PlcInvalidUnderlyingEvcoId
120 — PLC (ISO/IEC 15118) Authentication failed – invalid underlying EvcoID.
(Authentication)
PlcInvalidCertificate
121 — PLC (ISO/IEC 15118) Authentication failed – invalid certificate. (Authentication)
PlcTimeout
122 — PLC (ISO/IEC 15118) Authentication failed – time out error. (Authentication)
EvcoIdLocked
200 — EvcoID locked. (Authentication)
NoValidContract
210 — No valid contract. (Session)
PartnerNotFound
300 — Partner not found. (Session)
PartnerDidNotRespond
310 — Partner did not respond. (Session)
ServiceNotAvailable
320 — Service not available. (Session)
SessionIsInvalid
400 — Session is invalid. (Session)
CommunicationToEvseFailed
501 — Communication to EVSE failed. (EVSE)
NoEvConnectedToEvse
510 — No EV connected to EVSE. (EVSE)
EvseAlreadyReserved
601 — EVSE already reserved. (EVSE)
EvseAlreadyInUse
602 — EVSE already in use / wrong token. (EVSE)
UnknownEvseId
603 — Unknown EVSE ID. (EVSE)
EvseIdNotHubjectCompatible
604 — EVSE ID is not Hubject compatible. (EVSE)
EvseOutOfService
700 — EVSE out of service. (EVSE)
Custom(String)
A code this crate does not know, preserved exactly as it arrived.
Implementations§
Source§impl Code
impl Code
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
The specification’s description of this code.
Source§impl Code
impl Code
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Whether this code means the operation succeeded.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether re-sending the identical request could plausibly succeed.
True for transient conditions on Hubject’s side or the counterparty’s — 001, 002,
009, 021, 310, 320. False for every authorization decision, every data error
and every EVSE-state code: retrying 210 No valid contract or 601 EVSE already reserved
cannot help, and retrying 017 Unauthorized Access will not fix a certificate.
RetryPolicy uses exactly this.
Whether this code reports that the driver may not charge.
Every Authentication-area code plus 210 No valid contract — the codes that answer
“may this session start?” with “no”, as opposed to “something broke”.
Sourcepub fn is_evse_problem(&self) -> bool
pub fn is_evse_problem(&self) -> bool
Whether this code is about the state of the charging point rather than the request.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Code
impl<'de> Deserialize<'de> for Code
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for Code
Source§impl From<Code> for StatusCode
impl From<Code> for StatusCode
Source§impl JsonSchema for Code
Available on crate feature schema only.
impl JsonSchema for Code
schema only.Source§fn json_schema(_g: &mut SchemaGenerator) -> Schema
fn json_schema(_g: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for Code
impl Ord for Code
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Code
impl PartialOrd for Code
impl StructuralPartialEq for Code
Auto Trait Implementations§
impl Freeze for Code
impl RefUnwindSafe for Code
impl Send for Code
impl Sync for Code
impl Unpin for Code
impl UnsafeUnpin for Code
impl UnwindSafe for Code
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.