Module value

Module value 

Source
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 lifetime
  • OwnedValue: 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 transaction
  • OwnedValue - Owns its data, can be stored freely

§Performance Considerations

  • BorrowedValue has zero allocation overhead
  • OwnedValue allocates when created but can be passed around freely
  • Use BorrowedValue when processing data within a transaction
  • Use OwnedValue when data needs to outlive the transaction

Structs§

BorrowedValue
A borrowed reference to a value, tied to a transaction’s lifetime.
OwnedValue
An owned value that can outlive the transaction.

Enums§

MaybeOwnedValue
A value that may be either borrowed or owned.