pub struct Element {
pub name: String,
pub description: String,
pub color: Option<Color>,
pub metadata: Map<String, Value>,
pub attributes: Vec<Attribute>,
pub geometry: Geometry,
}
Expand description
Defines a single “object” or “shape” within the OMF file.
Each shape has a name plus other optional metadata, a “geometry” that describes a point-set, surface, etc., and a list of attributes that that exist on that geometry.
Fields§
§name: String
The element name. Names should be non-empty and unique.
description: String
Optional element description.
color: Option<Color>
Optional solid color.
metadata: Map<String, Value>
Arbitrary metadata.
attributes: Vec<Attribute>
List of attributes, if any.
geometry: Geometry
The geometry of the element.
Implementations§
source§impl Element
impl Element
sourcepub fn new(name: impl Into<String>, geometry: impl Into<Geometry>) -> Self
pub fn new(name: impl Into<String>, geometry: impl Into<Geometry>) -> Self
Create a new element with the given name and geometry.
Geometries will be automatically converted from their objects into enum variants.
sourcepub fn valid_locations(&self) -> &'static [Location]
pub fn valid_locations(&self) -> &'static [Location]
Returns the valid locations for attributes on this element.
sourcepub fn location_len(&self, location: Location) -> Option<u64>
pub fn location_len(&self, location: Location) -> Option<u64>
Returns the number of values needed for the given location.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Element
impl<'de> Deserialize<'de> for Element
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl JsonSchema for Element
impl JsonSchema for Element
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreimpl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)