pub struct ResourceBudgetTree { /* private fields */ }Expand description
Represents resource budget tree.
Implementations§
Source§impl ResourceBudgetTree
impl ResourceBudgetTree
Sourcepub fn new(
name: impl Into<String>,
limit: BudgetLimit,
) -> Result<Self, RuntimeContractViolation>
pub fn new( name: impl Into<String>, limit: BudgetLimit, ) -> Result<Self, RuntimeContractViolation>
Creates a new ResourceBudgetTree.
§Errors
Returns a contract violation when the root name is blank or malformed, or when its budget limit is invalid.
Sourcepub fn with_clock(
name: impl Into<String>,
limit: BudgetLimit,
clock: Arc<dyn MonotonicClock>,
) -> Result<Self, RuntimeContractViolation>
pub fn with_clock( name: impl Into<String>, limit: BudgetLimit, clock: Arc<dyn MonotonicClock>, ) -> Result<Self, RuntimeContractViolation>
Creates a tree with an injected monotonic clock.
§Errors
Returns a contract violation when the root name is blank or malformed, or when its budget limit is invalid.
Sourcepub fn with_clock_and_key_capacity(
name: impl Into<String>,
limit: BudgetLimit,
clock: Arc<dyn MonotonicClock>,
max_entries: usize,
) -> Result<Self, RuntimeContractViolation>
pub fn with_clock_and_key_capacity( name: impl Into<String>, limit: BudgetLimit, clock: Arc<dyn MonotonicClock>, max_entries: usize, ) -> Result<Self, RuntimeContractViolation>
Creates a tree whose dynamic key registry holds at most max_entries
names.
§Errors
Returns a contract violation when the root name is blank or malformed, or when its budget limit is invalid.
Sourcepub fn root(&self) -> ResourceBudget
pub fn root(&self) -> ResourceBudget
Returns the root.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ResourceBudgetTree
impl !UnwindSafe for ResourceBudgetTree
impl Freeze for ResourceBudgetTree
impl Send for ResourceBudgetTree
impl Sync for ResourceBudgetTree
impl Unpin for ResourceBudgetTree
impl UnsafeUnpin for ResourceBudgetTree
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