pub struct ManagedMemoryBudget { /* private fields */ }Expand description
The resolved memory numbers that drive the process resource budget.
The detected limit stays available for reporting while Self::managed_bytes
is what the ledger may charge. The budget covers the ledger objects that
register with the shared budget tree only.
Implementations§
Source§impl ManagedMemoryBudget
impl ManagedMemoryBudget
Sourcepub fn resolve(
detected: ProcessMemoryLimit,
configured: Option<ProcessMemoryLimit>,
policy: ManagedMemoryPolicy,
) -> Result<Self, RuntimeContractViolation>
pub fn resolve( detected: ProcessMemoryLimit, configured: Option<ProcessMemoryLimit>, policy: ManagedMemoryPolicy, ) -> Result<Self, RuntimeContractViolation>
Resolves the effective limit and the managed budget.
§Errors
Returns a contract violation when the policy ratio is out of range, when the headroom leaves no room inside the effective limit, or when the resolved managed budget is zero.
Sourcepub const fn detected(self) -> ProcessMemoryLimit
pub const fn detected(self) -> ProcessMemoryLimit
Returns the detected or explicitly configured process memory limit.
Sourcepub const fn effective_limit_bytes(self) -> u64
pub const fn effective_limit_bytes(self) -> u64
Returns the smaller of the detected limit and an explicit limit.
Sourcepub const fn requested_managed_bytes(self) -> u64
pub const fn requested_managed_bytes(self) -> u64
Returns the managed bytes the policy asked for before headroom applied.
Sourcepub const fn managed_bytes(self) -> u64
pub const fn managed_bytes(self) -> u64
Returns the managed bytes the ledger may charge.
Trait Implementations§
Source§impl Clone for ManagedMemoryBudget
impl Clone for ManagedMemoryBudget
impl Copy for ManagedMemoryBudget
Source§impl Debug for ManagedMemoryBudget
impl Debug for ManagedMemoryBudget
impl Eq for ManagedMemoryBudget
Source§impl PartialEq for ManagedMemoryBudget
impl PartialEq for ManagedMemoryBudget
impl StructuralPartialEq for ManagedMemoryBudget
Auto Trait Implementations§
impl Freeze for ManagedMemoryBudget
impl RefUnwindSafe for ManagedMemoryBudget
impl Send for ManagedMemoryBudget
impl Sync for ManagedMemoryBudget
impl Unpin for ManagedMemoryBudget
impl UnsafeUnpin for ManagedMemoryBudget
impl UnwindSafe for ManagedMemoryBudget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more