pub enum SemanticSurfaceType {
Known(KnownSemanticSurfaceType),
Extension(String),
}Expand description
The type member of a Semantic Object (§ 3.3 Semantics of geometric
primitives).
Known covers the surface types above. Any other value is a CityJSON
Extension semantic surface, which the spec requires to start with "+"
(eg "+ThermalSurface", § 8.5); Extension carries that string verbatim
so it round-trips byte for byte.
This nests the known names inside their own unit-only enum rather than
mixing unit variants with Extension(String) directly in one flat
#[serde(untagged)] enum – see crate::CityObjectType’s doc comment
for why a flat mix cannot round-trip (a unit variant under untagged
(de)serializes as null, not its name; this was verified empirically
while building CityObjectType, which has the identical shape).
§Match on the value, not on a reference
Each known name is also available flat, as an associated const (eg
SemanticSurfaceType::RoofSurface) – see the impl block below for
the full list. They are consts, not variants, and that distinction bites
exactly once, silently:
match *t {
SemanticSurfaceType::RoofSurface => { /* .. */ }
SemanticSurfaceType::Extension(ref s) => { let _ = s; }
_ => {}
}Note the *. match t where t: &SemanticSurfaceType, or match &t, is
E0308 (“mismatched types”), and rustc’s fix-it suggests renaming the arm
to a fresh binding – which compiles, and silently turns that arm into a
catch-all matching everything, because RoofSurface in pattern position
reads as a new irrefutable binding rather than as the constant. The _
arm is still required: Known and Extension are the real variants, so
the known names alone are not exhaustive.
Variants§
Known(KnownSemanticSurfaceType)
Extension(String)
Not a core CityJSON semantic surface type: a CityJSON Extension
surface type, always spelled with a leading "+".
Implementations§
Source§impl SemanticSurfaceType
Flat, spec-spelling access to each known variant (eg
SemanticSurfaceType::RoofSurface); see crate::CityObjectType’s
equivalent block for why these are associated consts rather than enum
variants – and, on
SemanticSurfaceType,
for why they must be matched on a value rather than on a reference.
impl SemanticSurfaceType
Flat, spec-spelling access to each known variant (eg
SemanticSurfaceType::RoofSurface); see crate::CityObjectType’s
equivalent block for why these are associated consts rather than enum
variants – and, on
SemanticSurfaceType,
for why they must be matched on a value rather than on a reference.
pub const RoofSurface: SemanticSurfaceType
pub const GroundSurface: SemanticSurfaceType
pub const WallSurface: SemanticSurfaceType
pub const ClosureSurface: SemanticSurfaceType
pub const OuterCeilingSurface: SemanticSurfaceType
pub const OuterFloorSurface: SemanticSurfaceType
pub const Window: SemanticSurfaceType
pub const Door: SemanticSurfaceType
pub const InteriorWallSurface: SemanticSurfaceType
pub const CeilingSurface: SemanticSurfaceType
pub const FloorSurface: SemanticSurfaceType
pub const WaterSurface: SemanticSurfaceType
pub const WaterGroundSurface: SemanticSurfaceType
pub const WaterClosureSurface: SemanticSurfaceType
pub const TrafficArea: SemanticSurfaceType
pub const AuxiliaryTrafficArea: SemanticSurfaceType
pub const TransportationMarking: SemanticSurfaceType
pub const TransportationHole: SemanticSurfaceType
Trait Implementations§
Source§impl Clone for SemanticSurfaceType
impl Clone for SemanticSurfaceType
Source§fn clone(&self) -> SemanticSurfaceType
fn clone(&self) -> SemanticSurfaceType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more