#[task_storage]Expand description
Derives the TaskStorage struct and generates optimized storage structures.
This macro analyzes field annotations and generates:
- A unified TaskStorage struct
- LazyField enum for lazy_vec fields
- Typed accessor methods on TaskStorage
- TaskStorageAccessors trait with accessor methods
- TaskFlags bitfield for boolean flags
§Field Attributes
All fields require two attributes:
§storage = "..." (required)
Specifies how the field is stored:
direct- Direct field access (e.g.,Option<OutputValue>)auto_set- Uses AutoSet for small collectionsauto_map- Uses AutoMap for key-value pairscounter_map- Uses CounterMap for reference countingflag- Boolean flag stored in a compact TaskFlags bitfield (field type must bebool)
§category = "..." (required)
Specifies the data category for persistence and access:
data- Frequently changed, bulk I/Ometa- Rarely changed, small I/Otransient- Field is not serialized (in-memory only)
§Optional Modifiers
inline- Field is stored inline on TaskStorage (default is lazy). Only use for hot-path fields that are frequently accessed.default- UseDefault::default()semantics instead ofOptionfor inline direct fields.filter_transient- Filter out transient values during serialization.- Serialization methods