pub enum GuardPolicy {
StackBudget,
DepthLimit(usize),
}Expand description
A GuardPolicy is the kind of limit that the recursion guard sets on a
guarded operation. The default policy,
StackBudget, is the policy for normal use.
Variants§
StackBudget
Stops the operation once it has used the stack that remained for guarded operations on its thread when it started (see the worker-thread requirement).
DepthLimit(usize)
Stops the operation when it would open more than the given number of descents at the same time. A parse opens about two descents for each level of nesting, and a traversal opens one descent for each level of the tree.
Use this policy in tests only. It stops an operation at the same input on every platform and with every build profile, which a test needs. However, the number of descents does not measure the stack that each level uses, so this policy does not protect against a stack overflow.
Implementations§
Source§impl GuardPolicy
impl GuardPolicy
Sourcepub fn init(self) -> StdDescentGuardInit
pub fn init(self) -> StdDescentGuardInit
Returns this policy as a StdDescentGuardInit, the configuration of
the descent guard that techy’s constructors take.
For StackBudget, the budget is resolved on
the thread that runs the operation, when the operation starts: it is the
stack that remains there for guarded operations, less techy’s own
headroom, or techy’s default budget on a thread that is not marked as a
worker thread (see the worker-thread
requirement).
Trait Implementations§
Source§impl Clone for GuardPolicy
impl Clone for GuardPolicy
impl Copy for GuardPolicy
Source§impl Debug for GuardPolicy
impl Debug for GuardPolicy
Source§impl Default for GuardPolicy
impl Default for GuardPolicy
impl Eq for GuardPolicy
Source§impl PartialEq for GuardPolicy
impl PartialEq for GuardPolicy
impl StructuralPartialEq for GuardPolicy
Auto Trait Implementations§
impl Forget for GuardPolicy
impl Freeze for GuardPolicy
impl Move for GuardPolicy
impl RefUnwindSafe for GuardPolicy
impl Send for GuardPolicy
impl Sync for GuardPolicy
impl Unpin for GuardPolicy
impl UnsafeUnpin for GuardPolicy
impl UnwindSafe for GuardPolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more