pub struct RestrictedRules {
may_place: Box<dyn Fn(usize, &ItemStack) -> bool + Send + Sync>,
may_pickup: Option<Box<dyn Fn(usize, &ItemStack, &ContainerLockGuard, &Player) -> bool + Send + Sync>>,
}Expand description
The predicates behind a RestrictedSlot, shared by every slot of a
section so a slot costs one pointer rather than one per predicate.
Fields§
§may_place: Box<dyn Fn(usize, &ItemStack) -> bool + Send + Sync>§may_pickup: Option<Box<dyn Fn(usize, &ItemStack, &ContainerLockGuard, &Player) -> bool + Send + Sync>>Implementations§
Source§impl RestrictedRules
impl RestrictedRules
pub(crate) fn place_only( may_place: impl Fn(usize, &ItemStack) -> bool + Send + Sync + 'static, ) -> Arc<Self> ⓘ
pub(crate) fn guarded( may_place: impl Fn(usize, &ItemStack) -> bool + Send + Sync + 'static, may_pickup: impl Fn(usize, &ItemStack, &ContainerLockGuard, &Player) -> bool + Send + Sync + 'static, ) -> Arc<Self> ⓘ
Auto Trait Implementations§
impl !RefUnwindSafe for RestrictedRules
impl !UnwindSafe for RestrictedRules
impl Freeze for RestrictedRules
impl Send for RestrictedRules
impl Sync for RestrictedRules
impl Unpin for RestrictedRules
impl UnsafeUnpin for RestrictedRules
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<>>