#[non_exhaustive]pub struct Id(/* private fields */);Expand description
Opaque non-empty server-assigned identifier (RFC 8620 §1.2).
Character set: URL-safe base64 alphabet (A-Za-z0-9, -, _), max 255 octets.
Clients MUST treat Id values as opaque strings — no parsing of structure.
Implementations§
Source§impl Id
impl Id
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consumes the value and returns the inner String.
Source§impl Id
impl Id
Sourcepub fn new_validated(s: impl Into<String>) -> Result<Self, ValidationError>
pub fn new_validated(s: impl Into<String>) -> Result<Self, ValidationError>
Construct an Id with RFC 8620 §1.2 syntax validation.
RFC 8620 §1.2 restricts Ids to the URL-safe base64 alphabet defined
in RFC 4648 §5, excluding the pad character =. The permitted
characters are therefore the ASCII alphanumerics (A-Z, a-z,
0-9), hyphen (-), and underscore (_). The string must also
be non-empty and at most 255 bytes.
§Errors
Returns ValidationError when the input does not satisfy
RFC 8620 §1.2. The error description contains a category keyword
that callers can match on if they need finer-grained handling:
"empty"— the input was an empty string;"exceeds 255 bytes"— the input was longer than the spec maximum;"invalid character"— the input contained at least one character outsideA-Z,a-z,0-9,-,_.
Use Id::from when the value is known to be valid (e.g. a string
received from a JMAP server response).