Struct djinn::Population [] [src]

pub struct Population<S: Simulation, C: Redis> {
    pub conn: C,
    // some fields omitted
}

An interface to the Redis-backed agent population.

Fields

Methods

impl<S: Simulation, C: Redis> Population<S, C>
[src]

Count the population size.

Get the world (state).

Set the world state.

Get an agent by id.

Get agents by ids. If you need to fetch multiple agents, you should use this as it makes only one network request.

Set an agent state by id.

Set multple agent states by ids. If you need to update multiple agents, you should use this as it makes only one network request.

Process queued updates (kill/spawn).

Lookup agents at a particular index.

Select a random agent from an index.

Select random agents from an index.

Count the members of an index.

Add an agent (id) to an index.

Add agents (ids) to an index.

Remove an agent (id) from an index.

Remove an agent (id) from an index.

Reset all indices.

Reset the population; i.e. deletes all agents and updates from Redis and resets all indices.

Trait Implementations

impl<S: Clone + Simulation, C: Clone + Redis> Clone for Population<S, C>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more