with

Macro with 

Source
macro_rules! with {
    ($entity:ty) => { ... };
    ($entity:ty, $($prop:expr),+ $(,)?) => { ... };
}
Expand description

Creates an entity-scoped bundle of property values for queries and entity initialization.

§Examples

// Add an entity with selected property values
let person = context.add_entity(with!(Person, Age(12), RiskCategory::High))?;

// Query the whole population by passing the entity type directly
let count = context.query_entity_count(Person);

// An inline query matching one property
let person = context.sample_entity(MyRng, with!(Person, Age(12)))?;

// A query matching multiple properties
let query = with!(Person, Age(12), RiskCategory::High);
let count = context.count_entities(query);