pub struct MessageId(/* private fields */);Expand description
An OCPP-J MessageId (1.6J calls it UniqueId): a string of at most 36 characters that
correlates a CALL with its CALLRESULT / CALLERROR.
Implementations§
Source§impl MessageId
impl MessageId
Sourcepub fn new(value: impl Into<String>) -> Result<Self, MessageIdError>
pub fn new(value: impl Into<String>) -> Result<Self, MessageIdError>
Validates and wraps a message id.
Sourcepub fn from_wire(value: &str) -> Self
pub fn from_wire(value: &str) -> Self
Wraps an id exactly as a peer sent it, including one that is too long.
The framing layer must echo the id it received verbatim or the peer cannot correlate
the answer, so length is reported — see is_conforming —
rather than silently changed.
Sourcepub fn is_conforming(&self) -> bool
pub fn is_conforming(&self) -> bool
Whether the id respects the 36-character limit.
Sourcepub fn truncating(value: &str) -> Self
pub fn truncating(value: &str) -> Self
Wraps a value, truncating it to MESSAGE_ID_MAX_LEN characters.
For ids this peer generates, so an over-long prefix cannot produce an invalid id.
Sourcepub fn unreadable() -> Self
pub fn unreadable() -> Self
The id OCPP 2.x prescribes when the incoming MessageId itself could not be read
(Part 4 §4.1.1).
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Unwraps the id.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MessageId
impl<'de> Deserialize<'de> for MessageId
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MessageId
Source§impl Ord for MessageId
impl Ord for MessageId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for MessageId
impl PartialOrd for MessageId
impl StructuralPartialEq for MessageId
Auto Trait Implementations§
impl Forget for MessageId
impl Freeze for MessageId
impl RefUnwindSafe for MessageId
impl Send for MessageId
impl Sync for MessageId
impl Unpin for MessageId
impl UnsafeUnpin for MessageId
impl UnwindSafe for MessageId
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
Mutably borrows from an owned value. Read more