Expand description
Summary: Zero-copy value types for Phase 2 read dominance. Copyright (c) YOAB. All rights reserved.
This module provides distinct types for borrowed vs owned values:
BorrowedValue: A reference tied to a transaction’s lifetimeOwnedValue: An owned copy that can outlive the transaction
§Design Philosophy
Thunder provides explicit type-level distinction between borrowed and owned data. This makes the zero-copy contract clear at compile time:
BorrowedValue<'tx>- Cannot outlive the transactionOwnedValue- Owns its data, can be stored freely
§Performance Considerations
BorrowedValuehas zero allocation overheadOwnedValueallocates when created but can be passed around freely- Use
BorrowedValuewhen processing data within a transaction - Use
OwnedValuewhen data needs to outlive the transaction
Structs§
- Borrowed
Value - A borrowed reference to a value, tied to a transaction’s lifetime.
- Owned
Value - An owned value that can outlive the transaction.
Enums§
- Maybe
Owned Value - A value that may be either borrowed or owned.