pub struct Lane {
pub id: LaneID,
pub lane_type: LaneType,
pub lane_center_pts: PolyLine,
pub width: Distance,
pub dir: Direction,
pub src_i: IntersectionID,
pub dst_i: IntersectionID,
pub driving_blackhole: bool,
pub biking_blackhole: bool,
}
Expand description
A road segment is broken down into individual lanes, which have a LaneType.
Fields
id: LaneID
lane_type: LaneType
lane_center_pts: PolyLine
width: Distance
dir: Direction
src_i: IntersectionID
dst_i: IntersectionID
driving_blackhole: bool
{Cars, bikes} trying to start or end here might not be able to reach most lanes in the graph, because this is near a border.
biking_blackhole: bool
Implementations
sourceimpl Lane
impl Lane
pub fn first_pt(&self) -> Pt2D
pub fn last_pt(&self) -> Pt2D
pub fn first_line(&self) -> Line
pub fn last_line(&self) -> Line
pub fn endpoint(&self, i: IntersectionID) -> Pt2D
sourcepub fn end_line(&self, i: IntersectionID) -> Line
pub fn end_line(&self, i: IntersectionID) -> Line
pt2 will be endpoint
pub fn dist_along_of_point(&self, pt: Pt2D) -> Option<Distance>
pub fn length(&self) -> Distance
pub fn intersections(&self) -> Vec<IntersectionID>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn number_parking_spots(&self, cfg: &MapConfig) -> usize
pub fn is_driving(&self) -> bool
pub fn is_biking(&self) -> bool
pub fn is_bus(&self) -> bool
pub fn is_walkable(&self) -> bool
pub fn is_sidewalk(&self) -> bool
pub fn is_shoulder(&self) -> bool
pub fn is_parking(&self) -> bool
pub fn is_light_rail(&self) -> bool
pub fn get_directed_parent(&self) -> DirectedRoadID
sourcepub fn get_nearest_side_of_road(&self, map: &Map) -> RoadSideID
pub fn get_nearest_side_of_road(&self, map: &Map) -> RoadSideID
This does the reasonable thing for the leftmost and rightmost lane on a road – except for roads with exactly one lane. For lanes in the middle of a road, it uses the direction of the lane – so bidirectional/contraflow cycletracks will produce weird results.
sourcepub fn get_lane_level_turn_restrictions(
&self,
road: &Road,
force_bus: bool
) -> Option<BTreeSet<TurnType>>
pub fn get_lane_level_turn_restrictions(
&self,
road: &Road,
force_bus: bool
) -> Option<BTreeSet<TurnType>>
Returns the set of allowed turn types, based on individual turn lane restrictions. None
means all turn types are allowed.
This will return None
for bus lanes, unless force_bus
is true. OSM turn restrictions on
bus lanes usually apply to regular vehicles, not the buses. When generating the turns for
buses, we probably don’t want to use the restrictions.
pub fn common_endpoint(&self, other: &Lane) -> CommonEndpoint
pub fn get_thick_polygon(&self) -> Polygon
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Lane
impl<'de> Deserialize<'de> for Lane
sourcefn 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
Auto Trait Implementations
impl RefUnwindSafe for Lane
impl Send for Lane
impl Sync for Lane
impl Unpin for Lane
impl UnwindSafe for Lane
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more