pub trait AttributeBind:
Debug
+ Sized
+ Any {
type StorageType: AttributeStorage<Self>;
type IdentifierType: From<DartIdType> + ToPrimitive + Clone;
const BIND_POLICY: OrbitPolicy;
}
Expand description
§Generic attribute trait
This trait is used to describe how a given attribute binds to the map, and how it should be stored in memory.
§Example
Using the same context as the for the AttributeUpdate
example, we can associate temperature
to faces and model a 2D heat-map:
use honeycomb_core::prelude::{FaceIdType, OrbitPolicy};
use honeycomb_core::attributes::{AttributeBind, AttrSparseVec};
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Temperature {
pub val: f32
}
impl AttributeBind for Temperature {
type StorageType = AttrSparseVec<Self>;
type IdentifierType = FaceIdType;
const BIND_POLICY: OrbitPolicy = OrbitPolicy::Face;
}
Required Associated Constants§
Sourceconst BIND_POLICY: OrbitPolicy
const BIND_POLICY: OrbitPolicy
OrbitPolicy
determining the kind of topological entity to which the attribute
is associated.
Required Associated Types§
Sourcetype StorageType: AttributeStorage<Self>
type StorageType: AttributeStorage<Self>
Storage type used for the attribute.
Sourcetype IdentifierType: From<DartIdType> + ToPrimitive + Clone
type IdentifierType: From<DartIdType> + ToPrimitive + Clone
Identifier type of the entity the attribute is bound to.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.