pub struct Rules {
pub cache: HashMap<Variable, HashSet<(Client, RatPubRegisterKind)>>,
/* private fields */
}Fields§
§cache: HashMap<Variable, HashSet<(Client, RatPubRegisterKind)>>Implementations§
Source§impl Rules
impl Rules
pub fn new() -> Self
pub fn insert(&mut self, variable: String, strategies: Vec<VariableHuman>)
pub fn new_id(&mut self) -> u32
Sourcepub fn remove_client(&mut self, client: &str)
pub fn remove_client(&mut self, client: &str)
Removes a client (ship) from the rules and cache.
- If the client is the ship performing a Shoot, Catch, Sail, or None action, the entire rule is removed but if there is another partner like in catch or shoot, the partner will be put into the cache with a subscriber/publisher state based on if was receiving it (subscriber) or sending it and the removing client wanted to catch it (publisher)
- If the client is a target in a Shoot action, it is removed from the target list. If the list becomes empty, the Shoot rule is removed, AND the shooter ship is registered as a publisher in the cache.
- Any cache registrations for the client are removed.
pub fn clear(&mut self)
pub fn raw(&self) -> &HashMap<String, Vec<VariableHuman>>
Sourcepub fn resolve_cache(&mut self)
pub fn resolve_cache(&mut self)
Resolves cache entries into rules in the store based on existing rules and new registrations. Generates only Shoot actions, never Catch actions.
- If a variable exists in the store AND has existing Shoot rules, cache registrations for that variable are used to update/regenerate the Shoot rules based on the combined set of publishers and subscribers from the store and cache. The cache entry is removed.
- If a variable is NOT in the store, OR is in the store but lacks Shoot rules, it requires a publisher/subscriber pair within the cache to generate new Shoot rules. These are added (either to a new entry or by extending a non-Shoot entry in the store). If no pair exists in the cache, the cache entry remains.
pub fn register( &mut self, var: String, client: String, kind: RatPubRegisterKind, )
Trait Implementations§
impl Eq for Rules
impl StructuralPartialEq for Rules
Auto Trait Implementations§
impl Freeze for Rules
impl RefUnwindSafe for Rules
impl Send for Rules
impl Sync for Rules
impl Unpin for Rules
impl UnwindSafe for Rules
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.