pub enum Edge {
Walk {
id: EdgeId,
a: NodeId,
b: NodeId,
one_way: Option<Direction>,
shortcut: bool,
gating: Option<EdgeGating>,
},
Stair {
id: EdgeId,
a: NodeId,
b: NodeId,
one_way: Option<Direction>,
shortcut: bool,
gating: Option<EdgeGating>,
},
Drop {
id: EdgeId,
a: NodeId,
b: NodeId,
falls: Direction,
shortcut: bool,
gating: Option<EdgeGating>,
},
Barred {
id: EdgeId,
a: NodeId,
b: NodeId,
opens_from: OpensFrom,
one_way: Option<Direction>,
shortcut: bool,
gating: EdgeGating,
},
Vision {
id: EdgeId,
a: NodeId,
b: NodeId,
},
}Expand description
A connection between two places.
Internally tagged on class, in the same shape every other tagged union in
this DSL uses. The tagging is load-bearing rather than stylistic: falls
belongs to a drop and opens_from belongs to a barred way, and writing
either on a walk would be a declaration nothing reads. Under the tag, serde’s
deny_unknown_fields refuses it as an ordinary DW0100 — so the illegal
state is unrepresentable and no diagnostic has to police it.
Variants§
Walk
A way a body walks, at grade.
Fields
gating: Option<EdgeGating>What a body must hold to pass.
Stair
A way a body climbs or descends on built treads.
Fields
gating: Option<EdgeGating>What a body must hold to pass.
Drop
A fall. One-way by construction, which is why the direction is required here and optional on its siblings: a body that has dropped cannot climb back up the way it came.
Fields
gating: Option<EdgeGating>What a body must hold to pass.
Barred
A sealed connection some effect opens.
Fields
opens_from: OpensFromWhich side can open it. The one-side-openable door is spelled here, and it is a property of the connection rather than of any campaign’s fiction.
gating: EdgeGatingWhat opens it. Required to say something (DW0818): a barred way
nothing opens is a wall, and a barred way anything opens is not
barred.
Vision
A line of sight between two places, in either direction. Carries no body, so it is not a traversal edge and the reachability closure never walks it; stage 4 gives it a sightline rather than a seam (spec-0049 §4.4).
Implementations§
Source§impl Edge
impl Edge
Sourcepub fn is_traversal(&self) -> bool
pub fn is_traversal(&self) -> bool
True if a body passes along this edge. A vision edge does not.
Sourcepub fn direction(&self) -> Option<Direction>
pub fn direction(&self) -> Option<Direction>
Which way a body may pass, or None for both ways (and for a vision
edge, which carries none).
Sourcepub fn gating(&self) -> Option<&EdgeGating>
pub fn gating(&self) -> Option<&EdgeGating>
What a body must hold to pass, or None where the edge demands nothing.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Edge
impl<'de> Deserialize<'de> for Edge
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>,
Source§impl JsonSchema for Edge
impl JsonSchema for Edge
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more