#[repr(u8)]pub enum RefMode {
None = 0,
NullOnly = 1,
Tracking = 2,
}Expand description
Controls how reference and null flags are handled during serialization.
This enum combines nullable semantics and reference tracking into one parameter, enabling fine-grained control per type and per field:
None= non-nullable, no ref tracking (primitives)NullOnly= nullable, no circular ref trackingTracking= nullable, with circular ref tracking (Rc/Arc/Weak)
Variants§
None = 0
Skip ref handling entirely. No ref/null flags are written/read. Used for non-nullable primitives or when caller handles ref externally.
NullOnly = 1
Only null check without reference tracking. Write: NullFlag (-3) for None, NotNullValueFlag (-1) for Some. Read: Read flag and return ForyDefault on null.
Tracking = 2
Full reference tracking with circular reference support. Write: Uses RefWriter which writes NullFlag, RefFlag+refId, or RefValueFlag. Read: Uses RefReader with full reference resolution.
Implementations§
Source§impl RefMode
impl RefMode
Sourcepub const fn from_flags(nullable: bool, track_ref: bool) -> Self
pub const fn from_flags(nullable: bool, track_ref: bool) -> Self
Create RefMode from nullable and track_ref flags.
Sourcepub const fn has_ref_flag(self) -> bool
pub const fn has_ref_flag(self) -> bool
Check if this mode reads/writes ref flags.
Sourcepub const fn tracks_refs(self) -> bool
pub const fn tracks_refs(self) -> bool
Check if this mode tracks circular references.
Sourcepub const fn is_nullable(self) -> bool
pub const fn is_nullable(self) -> bool
Check if this mode handles nullable values.