Struct map_model::LaneSpec

pub struct LaneSpec {
    pub lt: LaneType,
    pub dir: Direction,
    pub width: Distance,
    pub allowed_turns: EnumSet<TurnDirection>,
}

Fields§

§lt: LaneType§dir: Direction§width: Distance§allowed_turns: EnumSet<TurnDirection>

Turn restrictions for this lane. An empty set represents that no restrictions are indicated (though local rules might still dictate restrictions). Turns for specific vehicle types (turn:bus:lanes and such) are not yet captured.

Implementations§

§

impl LaneSpec

pub fn maybe_add_bike_lanes( lanes_ltr: &mut Vec<LaneSpec>, buffer_type: Option<BufferType>, driving_side: DrivingSide )

§

impl LaneSpec

pub fn add_new_lane( lanes_ltr: &mut Vec<LaneSpec>, lt: LaneType, highway_type: &str, driving_side: DrivingSide ) -> usize

Returns the index where the new lane was inserted

§

impl LaneSpec

pub fn toggle_road_direction( lanes_ltr: &mut Vec<LaneSpec>, driving_side: DrivingSide )

Convert the driving lanes of a road between one-way forwards, one-way backwards, and bidirectional. It should be idempotent to apply this 3 times in a row. Even when an existing one-way street is narrow, it can be made bidirectional by splitting into two very narrow lanes.

§

impl LaneSpec

pub fn create_for_test(input_lt: &str, input_dir: &str) -> Vec<LaneSpec>

Transforms a string describing lane types and directions, like “spddps” and “vv^^^^^”, into a list of LaneSpecs. Useful for unit tests.

pub fn check_lanes_ltr( actual_lanes_ltr: &[LaneSpec], description: String, input_lt: &str, input_dir: &str, expected_lt: &str, expected_dir: &str, ok: &mut bool )

This is meant for table-driven unit tests. Call this on the transformed / output lanes. If the lanes don’t match, ok will be set to false and appropriate errors will be printed.

§

impl LaneSpec

pub fn typical_lane_widths( lt: LaneType, highway_type: &str ) -> Vec<(Distance, &'static str)>

For a given lane type, returns some likely widths. This may depend on the OSM highway type of the road. The first value returned will be used as a default.

pub fn typical_lane_width(lt: LaneType) -> Distance

Pick a reasonable default for a lane width, without any context on locale or tags.

pub fn oneway_for_driving(lanes: &[LaneSpec]) -> Option<Direction>

None if bidirectional. If it’s one-way, which direction is that relative to the road? (Usually forwards)

Trait Implementations§

§

impl Clone for LaneSpec

§

fn clone(&self) -> LaneSpec

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for LaneSpec

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for LaneSpec

§

fn deserialize<__D>( __deserializer: __D ) -> Result<LaneSpec, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl PartialEq for LaneSpec

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for LaneSpec

§

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

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

impl StructuralPartialEq for LaneSpec

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool

source§

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