pub struct CachedRecipeCheck<D: RecipeMatches<I> + DowncastType, I: RecipeInput> {
recipe_type: &'static RecipeType<D, I>,
last_recipe: Option<TypedRecipeRef<D, I>>,
}Expand description
Caches the last successful recipe for one operational recipe type.
This mirrors Vanilla’s RecipeManager.CachedCheck: the cached recipe is
tested first, then matching falls back to the registry’s deterministic scan.
Fields§
§recipe_type: &'static RecipeType<D, I>§last_recipe: Option<TypedRecipeRef<D, I>>Implementations§
Source§impl<D: RecipeMatches<I> + DowncastType, I: RecipeInput> CachedRecipeCheck<D, I>
impl<D: RecipeMatches<I> + DowncastType, I: RecipeInput> CachedRecipeCheck<D, I>
Sourcepub const fn new(recipe_type: &'static RecipeType<D, I>) -> Self
pub const fn new(recipe_type: &'static RecipeType<D, I>) -> Self
Creates an empty cache for one recipe type.
Sourcepub fn find_match(
&mut self,
registry: &RecipeRegistry,
input: &I,
) -> Option<TypedRecipeRef<D, I>>
pub fn find_match( &mut self, registry: &RecipeRegistry, input: &I, ) -> Option<TypedRecipeRef<D, I>>
Finds a matching recipe, testing the last successful recipe first.
Auto Trait Implementations§
impl<D, I> Freeze for CachedRecipeCheck<D, I>
impl<D, I> RefUnwindSafe for CachedRecipeCheck<D, I>where
D: RefUnwindSafe,
impl<D, I> Send for CachedRecipeCheck<D, I>
impl<D, I> Sync for CachedRecipeCheck<D, I>
impl<D, I> Unpin for CachedRecipeCheck<D, I>
impl<D, I> UnsafeUnpin for CachedRecipeCheck<D, I>
impl<D, I> UnwindSafe for CachedRecipeCheck<D, I>where
D: RefUnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>