pub enum UserId {
Integer(i64),
String(String),
}Expand description
user identity as accepted by the Odoo-facing call contract
Odoo normally uses integer user ids, while legacy and test callers may send
string ids
the runtime canonicalizes numeric strings before indexing room
state so "42" and 42 cannot become two live users in the same call
non-numeric strings remain valid compatibility ids
Deserialization rejects string identities exceeding 256 decoded UTF-8 bytes, before numeric-string normalization. Direct Rust construction retains the existing enum API and does not enforce this wire-input limit.
Variants§
Implementations§
Source§impl UserId
impl UserId
Sourcepub const MAX_STRING_BYTES: usize = 256
pub const MAX_STRING_BYTES: usize = 256
Maximum decoded UTF-8 byte length accepted for a wire string identity.
pub(crate) fn deserialize_string<'de, D>(
deserializer: D,
) -> Result<String, D::Error>where
D: Deserializer<'de>,
Sourcepub fn path_segment(&self) -> Cow<'_, str>
pub fn path_segment(&self) -> Cow<'_, str>
return the path representation used by diagnostics and bundle keys string ids retain their raw representation
Sourcepub fn normalized_for_runtime(self) -> Self
pub fn normalized_for_runtime(self) -> Self
return the runtime key form for this user id
numeric strings are parsed into Self::Integer so all room state,
diagnostics lookup, disconnect handling and subscription logic use one
canonical key
non-numeric strings are preserved as compatibility identities
Sourcepub fn runtime_normalized(&self) -> Self
pub fn runtime_normalized(&self) -> Self
borrowing variant of Self::normalized_for_runtime
use this when the caller owns a borrowed auth or protocol payload and needs the canonical runtime key without consuming that payload