#[non_exhaustive]pub enum TypeIdentifier {
Show 16 variants
None,
Primitive(PrimitiveKind),
String8Small {
bound: u8,
},
String8Large {
bound: u32,
},
String16Small {
bound: u8,
},
String16Large {
bound: u32,
},
PlainSequenceSmall {
header: PlainCollectionHeader,
bound: u8,
element: Box<TypeIdentifier>,
},
PlainSequenceLarge {
header: PlainCollectionHeader,
bound: u32,
element: Box<TypeIdentifier>,
},
PlainArraySmall {
header: PlainCollectionHeader,
array_bounds: Vec<u8>,
element: Box<TypeIdentifier>,
},
PlainArrayLarge {
header: PlainCollectionHeader,
array_bounds: Vec<u32>,
element: Box<TypeIdentifier>,
},
PlainMapSmall {
header: PlainCollectionHeader,
bound: u8,
element: Box<TypeIdentifier>,
key_flags: CollectionElementFlag,
key: Box<TypeIdentifier>,
},
PlainMapLarge {
header: PlainCollectionHeader,
bound: u32,
element: Box<TypeIdentifier>,
key_flags: CollectionElementFlag,
key: Box<TypeIdentifier>,
},
StronglyConnectedComponent(StronglyConnectedComponentId),
EquivalenceHashMinimal(EquivalenceHash),
EquivalenceHashComplete(EquivalenceHash),
Unknown(u8),
}Expand description
TypeIdentifier — XTypes §7.3.4.2.
Direkt identifiziert primitive und plain-Typen, indirekt (ueber
14-byte Hash) composite Types (struct, union, etc.). Plain
collections koennen rekursiv TypeIdentifier enthalten, deshalb
Box fuer die nested Varianten.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
TK_NONE — Spec-Sentinel für “kein TypeIdentifier bekannt”.
Primitive(PrimitiveKind)
Primitive ohne Body — discriminator trägt alle Infos.
String8Small
string<Bound> mit 8-bit Zeichen, Bound <= 255 bytes.
String8Large
string<Bound> mit Bound > 255.
String16Small
wstring<Bound> mit Bound <= 255 chars.
String16Large
wstring<Bound>.
PlainSequenceSmall
sequence<T, N> mit N <= 255.
Fields
header: PlainCollectionHeaderHeader (EquivKind des Elements + Flags).
element: Box<TypeIdentifier>Element-TypeIdentifier.
PlainSequenceLarge
sequence<T, N> mit N > 255.
PlainArraySmall
T[D1, D2, ...] mit allen Dimensionen <= 255.
PlainArrayLarge
T[D1, D2, ...] mit mindestens einer Dimension > 255.
PlainMapSmall
map<K, V, N> mit N <= 255.
Fields
header: PlainCollectionHeaderHeader.
element: Box<TypeIdentifier>Value-TypeIdentifier.
key_flags: CollectionElementFlagKey-Flags.
key: Box<TypeIdentifier>Key-TypeIdentifier.
PlainMapLarge
map<K, V, N> mit N > 255.
Fields
header: PlainCollectionHeaderHeader.
element: Box<TypeIdentifier>Value-TypeIdentifier.
key_flags: CollectionElementFlagKey-Flags.
key: Box<TypeIdentifier>Key-TypeIdentifier.
StronglyConnectedComponent(StronglyConnectedComponentId)
Stark-zusammenhaengende Komponente (rekursive Typen) — §7.3.4.9.
EquivalenceHashMinimal(EquivalenceHash)
14-byte Hash des MinimalTypeObject.
EquivalenceHashComplete(EquivalenceHash)
14-byte Hash des CompleteTypeObject.
Unknown(u8)
Unbekannter/unsupportierter Discriminator (Forward-Compat).
Implementations§
Source§impl TypeIdentifier
impl TypeIdentifier
Sourcepub const MAX_DECODE_DEPTH: usize = 16
pub const MAX_DECODE_DEPTH: usize = 16
Maximum-Rekursionstiefe beim Wire-Decode eines verschachtelten
TypeIdentifier (Plain-Collections koennen rekursiv referenzieren).
Schuetzt vor Stack-Overflow bei pathologischen Datagrammen.
Sourcepub fn encode_into(&self, w: &mut BufferWriter) -> Result<(), EncodeError>
pub fn encode_into(&self, w: &mut BufferWriter) -> Result<(), EncodeError>
Encoded als XCDR2-little-endian Bytes (TypeIdentifier ohne Encapsulation-Header — der wird vom Caller (z.B. TYPE_INFORMATION PID oder TypeLookup-RPC) geliefert).
§Errors
EncodeError bei Buffer-Overflow (sehr unwahrscheinlich fuer
normale Typen; 2^32-Grenze bei large-Kinds).
Sourcepub fn decode_from(r: &mut BufferReader<'_>) -> Result<Self, DecodeError>
pub fn decode_from(r: &mut BufferReader<'_>) -> Result<Self, DecodeError>
Decode aus XCDR2-little-endian Bytes. Der Reader muss auf den
Discriminator positioniert sein. Interne Rekursion ist gecapt
(siehe Self::MAX_DECODE_DEPTH).
§Errors
DecodeError bei Buffer-Underflow, inkonsistentem Length-Feld
oder wenn die maximale Rekursionstiefe ueberschritten wird.
Sourcepub const fn discriminator(&self) -> u8
pub const fn discriminator(&self) -> u8
Der Discriminator-Byte fuer diesen TypeIdentifier.
Sourcepub fn to_bytes_le(&self) -> Result<Vec<u8>, EncodeError>
pub fn to_bytes_le(&self) -> Result<Vec<u8>, EncodeError>
Sourcepub fn from_bytes_le(bytes: &[u8]) -> Result<Self, DecodeError>
pub fn from_bytes_le(bytes: &[u8]) -> Result<Self, DecodeError>
Trait Implementations§
Source§impl Clone for TypeIdentifier
impl Clone for TypeIdentifier
Source§fn clone(&self) -> TypeIdentifier
fn clone(&self) -> TypeIdentifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypeIdentifier
impl Debug for TypeIdentifier
Source§impl Default for TypeIdentifier
impl Default for TypeIdentifier
Source§fn default() -> TypeIdentifier
fn default() -> TypeIdentifier
Source§impl PartialEq for TypeIdentifier
impl PartialEq for TypeIdentifier
Source§fn eq(&self, other: &TypeIdentifier) -> bool
fn eq(&self, other: &TypeIdentifier) -> bool
self and other values to be equal, and is used by ==.