Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::SourceCredit Class Reference

Move-only credit; backing storage must be destroyed before this final credit owner. More...

#include <source_budget.hpp>

Public Member Functions

 SourceCredit ()=default
 Empty credit.
 ~SourceCredit ()
 Return the reservation to its root.
 SourceCredit (SourceCredit &&other) noexcept
SourceCredit & operator= (SourceCredit other) noexcept
 SourceCredit (const SourceCredit &)=delete
std::expected< SourceCredit, SourceError > split (SourceBudgetUsage amount) noexcept
SourceBudgetUsage usage () const noexcept

Friends

class SourceBudget

Detailed Description

Move-only credit; backing storage must be destroyed before this final credit owner.

Constructor & Destructor Documentation

◆ SourceCredit()

portals::SourceCredit::SourceCredit ( SourceCredit && other)
noexcept
Parameters
otherCredit to transfer without allocation and leave empty.

Member Function Documentation

◆ operator=()

SourceCredit & portals::SourceCredit::operator= ( SourceCredit other)
noexcept
Parameters
otherCredit replacing this reservation.
Returns
This owner; old credit is released after replacement.

◆ split()

std::expected< SourceCredit, SourceError > portals::SourceCredit::split ( SourceBudgetUsage amount)
noexcept
Parameters
amountSub-reservation to transfer; each field must fit this credit.
Returns
Independent credit on the same root, or INVALID_ARGUMENT without mutation.

◆ usage()

SourceBudgetUsage portals::SourceCredit::usage ( ) const
noexcept
Returns
This owner's reservation, not aggregate usage.

The documentation for this class was generated from the following file: