pub struct FieldDef {
pub name: String,
pub field_type: FieldType,
pub mutability: FieldMutability,
pub units: Option<String>,
pub bounds: Option<(f32, f32)>,
pub boundary_behavior: BoundaryBehavior,
}Expand description
Definition of a field registered in a simulation world.
Fields are the fundamental unit of per-cell state. Each field has a type,
mutability class, optional bounds, and boundary behavior. Fields are
registered at world creation; FieldId is the index into the field list.
§Examples
use murk_core::{FieldDef, FieldType, FieldMutability, BoundaryBehavior};
// A scalar field that is reallocated every tick.
let heat = FieldDef {
name: "heat".into(),
field_type: FieldType::Scalar,
mutability: FieldMutability::PerTick,
units: Some("kelvin".into()),
bounds: Some((0.0, 1000.0)),
boundary_behavior: BoundaryBehavior::Clamp,
};
// A 3D velocity vector allocated once (static terrain data).
let velocity = FieldDef {
name: "wind".into(),
field_type: FieldType::Vector { dims: 3 },
mutability: FieldMutability::Static,
units: None,
bounds: None,
boundary_behavior: BoundaryBehavior::Clamp,
};Fields§
§name: StringHuman-readable name for debugging and logging.
field_type: FieldTypeData type and dimensionality.
mutability: FieldMutabilityAllocation strategy across ticks.
units: Option<String>Optional unit annotation (e.g., "meters/sec").
bounds: Option<(f32, f32)>Optional (min, max) bounds for field values.
boundary_behavior: BoundaryBehaviorBehavior when values exceed declared bounds.
Trait Implementations§
impl StructuralPartialEq for FieldDef
Auto Trait Implementations§
impl Freeze for FieldDef
impl RefUnwindSafe for FieldDef
impl Send for FieldDef
impl Sync for FieldDef
impl Unpin for FieldDef
impl UnwindSafe for FieldDef
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
Mutably borrows from an owned value. Read more