pub struct BruteForceMessages<M> { /* private fields */ }Expand description
Brute-force message list – every agent can read every message.
This is the simplest messaging pattern. Each step, agents push messages in the output phase, then iterate all messages in the input phase.
Performance: O(N) per agent for N messages. Suitable for small populations or global broadcasts.
Mirrors FlameGPU2 MessageBruteForce.
Implementations§
Source§impl<M: Clone> BruteForceMessages<M>
impl<M: Clone> BruteForceMessages<M>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with pre-allocated capacity.
Sourcepub fn try_output(&mut self, message: M) -> Result<(), MessagePhaseError>
pub fn try_output(&mut self, message: M) -> Result<(), MessagePhaseError>
Try to output a message (phase 1), returning a typed phase error on misuse.
Sourcepub fn finalize(&mut self)
pub fn finalize(&mut self)
Finalize the message list for reading (phase boundary).
For brute-force, this is a no-op but enforces the two-phase protocol.
Sourcepub fn read_all(&self) -> &[M]
pub fn read_all(&self) -> &[M]
Iterate all messages (phase 2).
§Panics
Panics if called before finalize. Use
try_read_all to handle phase errors explicitly.
Sourcepub fn try_read_all(&self) -> Result<&[M], MessagePhaseError>
pub fn try_read_all(&self) -> Result<&[M], MessagePhaseError>
Try to iterate all messages (phase 2), returning a typed phase error on misuse.
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Whether the message buffer has been finalized for reading.
Trait Implementations§
Source§impl<M: Clone> Clone for BruteForceMessages<M>
impl<M: Clone> Clone for BruteForceMessages<M>
Source§fn clone(&self) -> BruteForceMessages<M>
fn clone(&self) -> BruteForceMessages<M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more