pub struct EventsToRegister(/* private fields */);Expand description
Contains all the events and domains that a propagator needs to be enqueued for.
Implementations§
Source§impl EventsToRegister
impl EventsToRegister
Sourcepub fn empty() -> EventsToRegister
pub fn empty() -> EventsToRegister
Create an EventsToRegister without any variables.
This is the uncommon case. Without registering for variable events, a propagator will never be enqueued automatically. However, certain propagators like, e.g., compound propagators, may not be able to register during construction in which case they will be enqueued explicitly when a constraint is added to them. The nogood propagator is an example of such a propagator.
Sourcepub fn builder() -> EventsToRegisterBuilder
pub fn builder() -> EventsToRegisterBuilder
Create a new EventsToRegisterBuilder.
If no event registrations will be made, use EventsToRegister::empty instead.
Calling EventsToRegisterBuilder::build without any registrations will cause a panic.
Sourcepub fn add(
&mut self,
target: &impl EventTarget,
domain_events: DomainEvents,
local_id: LocalId,
)
pub fn add( &mut self, target: &impl EventTarget, domain_events: DomainEvents, local_id: LocalId, )
Add a new event registration to an existing instance of self.
§Example
use pumpkin_core::propagation::DomainEvents;
use pumpkin_core::propagation::EventsToRegister;
use pumpkin_core::propagation::LocalId;
use pumpkin_core::variables::DomainId;
let v1 = DomainId::new(0);
let v2 = DomainId::new(0);
let mut registration = EventsToRegister::builder()
.add(&v1, DomainEvents::ANY_INT, LocalId::from(0))
.build();
// Extend the events to register with another variable.
registration.add(&v2, DomainEvents::ANY_INT, LocalId::from(1));Sourcepub fn iter(&self) -> impl ExactSizeIterator
pub fn iter(&self) -> impl ExactSizeIterator
Iterate the registrations already made.
Trait Implementations§
Source§impl Clone for EventsToRegister
impl Clone for EventsToRegister
Source§fn clone(&self) -> EventsToRegister
fn clone(&self) -> EventsToRegister
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventsToRegister
impl Debug for EventsToRegister
Source§impl EventDispatcher for EventsToRegister
impl EventDispatcher for EventsToRegister
Auto Trait Implementations§
impl Freeze for EventsToRegister
impl RefUnwindSafe for EventsToRegister
impl Send for EventsToRegister
impl Sync for EventsToRegister
impl Unpin for EventsToRegister
impl UnsafeUnpin for EventsToRegister
impl UnwindSafe for EventsToRegister
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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