Skip to main content

Edge

Enum Edge 

Source
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

§id: EdgeId

Edge id (edge/<kebab>), unique within the graph.

§a: NodeId

One end.

§b: NodeId

The other end.

§one_way: Option<Direction>

Declared directionality; absent means a body passes both ways.

§shortcut: bool

This connection exists to close a loop (DW0820).

§gating: Option<EdgeGating>

What a body must hold to pass.

§

Stair

A way a body climbs or descends on built treads.

Fields

§id: EdgeId

Edge id (edge/<kebab>), unique within the graph.

§a: NodeId

One end.

§b: NodeId

The other end.

§one_way: Option<Direction>

Declared directionality; absent means a body passes both ways.

§shortcut: bool

This connection exists to close a loop (DW0820).

§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

§id: EdgeId

Edge id (edge/<kebab>), unique within the graph.

§a: NodeId

One end.

§b: NodeId

The other end.

§falls: Direction

Which way it falls.

§shortcut: bool

This connection exists to close a loop (DW0820).

§gating: Option<EdgeGating>

What a body must hold to pass.

§

Barred

A sealed connection some effect opens.

Fields

§id: EdgeId

Edge id (edge/<kebab>), unique within the graph.

§a: NodeId

One end.

§b: NodeId

The other end.

§opens_from: OpensFrom

Which 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.

§one_way: Option<Direction>

Declared directionality once open; absent means both ways.

§shortcut: bool

This connection exists to close a loop (DW0820).

§gating: EdgeGating

What 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).

Fields

§id: EdgeId

Edge id (edge/<kebab>), unique within the graph.

§a: NodeId

One end.

§b: NodeId

The other end.

Implementations§

Source§

impl Edge

Source

pub fn id(&self) -> &EdgeId

The edge’s id.

Source

pub fn a(&self) -> &NodeId

The a end.

Source

pub fn b(&self) -> &NodeId

The b end.

Source

pub fn class(&self) -> &'static str

The class name as the document spells it.

Source

pub fn is_traversal(&self) -> bool

True if a body passes along this edge. A vision edge does not.

Source

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).

Source

pub fn shortcut(&self) -> bool

True if this edge is marked as closing a loop.

Source

pub fn gating(&self) -> Option<&EdgeGating>

What a body must hold to pass, or None where the edge demands nothing.

Trait Implementations§

Source§

impl Clone for Edge

Source§

fn clone(&self) -> Edge

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Edge

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Edge

Source§

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 Edge

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Edge

Source§

fn eq(&self, other: &Edge) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Edge

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Edge

Auto Trait Implementations§

§

impl Freeze for Edge

§

impl RefUnwindSafe for Edge

§

impl Send for Edge

§

impl Sync for Edge

§

impl Unpin for Edge

§

impl UnsafeUnpin for Edge

§

impl UnwindSafe for Edge

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.