ocpp-types 0.1.0

Strongly typed OCPP 1.6J, 2.0.1, and 2.1 message types for Rust. no_std, no alloc, embedded-friendly.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct IdTag(heapless::String<20>);

impl IdTag {
    pub fn as_str(&self) -> &str {
        &self.0
    }
}

impl TryFrom<&str> for IdTag {
    type Error = ();

    fn try_from(value: &str) -> Result<Self, Self::Error> {
        heapless::String::try_from(value).map(Self)
    }
}