pub struct Path {
steps: VecDeque<PathStep>,
orig_req: PathRequest,
total_length: Distance,
crossed_so_far: Distance,
uber_turns: VecDeque<UberTurn>,
currently_inside_ut: Option<UberTurn>,
blocked_starts: Vec<LaneID>,
}
Fields
steps: VecDeque<PathStep>
orig_req: PathRequest
total_length: Distance
crossed_so_far: Distance
uber_turns: VecDeque<UberTurn>
currently_inside_ut: Option<UberTurn>
blocked_starts: Vec<LaneID>
Implementations
sourceimpl Path
impl Path
pub(crate) fn new(
map: &Map,
steps: Vec<PathStep>,
orig_req: PathRequest,
uber_turns: Vec<UberTurn>,
blocked_starts: Vec<LaneID>
) -> Path
sourcepub fn dist_crossed_from_step(&self, map: &Map, step: &PathStep) -> Distance
pub fn dist_crossed_from_step(&self, map: &Map, step: &PathStep) -> Distance
Once we finish this PathStep, how much distance will be crossed? If the step is at the beginning or end of our path, then the full length may not be used.
sourcepub fn get_req(&self) -> &PathRequest
pub fn get_req(&self) -> &PathRequest
The original PathRequest used to produce this path. If the path has been modified since creation, the start and end of the request won’t match up with the current path steps.
pub fn crossed_so_far(&self) -> Distance
pub fn total_length(&self) -> Distance
pub fn percent_dist_crossed(&self) -> f64
pub fn is_empty(&self) -> bool
pub fn is_last_step(&self) -> bool
pub fn isnt_last_step(&self) -> bool
pub fn currently_inside_ut(&self) -> &Option<UberTurn>
pub fn about_to_start_ut(&self) -> Option<&UberTurn>
pub fn shift(&mut self, map: &Map) -> PathStep
pub fn add(&mut self, step: PathStep, map: &Map)
pub fn is_upcoming_uber_turn_component(&self, t: TurnID) -> bool
sourcepub fn modify_step(&mut self, idx: usize, step: PathStep, map: &Map)
pub fn modify_step(&mut self, idx: usize, step: PathStep, map: &Map)
Trusting the caller to do this in valid ways.
pub fn current_step(&self) -> PathStep
pub fn next_step(&self) -> PathStep
pub fn maybe_next_step(&self) -> Option<PathStep>
pub fn last_step(&self) -> PathStep
sourcepub fn trace(&self, map: &Map) -> Option<PolyLine>
pub fn trace(&self, map: &Map) -> Option<PolyLine>
Traces along the path from its originally requested start. This is only valid to call for an umodified path.
It mostly seems the PolyLine’s length will match total_length
, but callers beware if
you’re relying on this – check walking paths with the buggy sharp angles particularly.
sourcepub fn trace_from_start(
&self,
map: &Map,
start_dist: Distance
) -> Option<PolyLine>
pub fn trace_from_start(
&self,
map: &Map,
start_dist: Distance
) -> Option<PolyLine>
Traces along the path from a specified distance along the first step until the end.
sourcepub fn trace_v2(&self, map: &Map) -> Result<Polygon>
pub fn trace_v2(&self, map: &Map) -> Result<Polygon>
Draws the thickened path, matching entire roads. Ignores the path’s exact starting and ending distance.
pub fn get_steps(&self) -> &VecDeque<PathStep>
sourcepub fn estimate_duration(&self, map: &Map, max_speed: Option<Speed>) -> Duration
pub fn estimate_duration(&self, map: &Map, max_speed: Option<Speed>) -> Duration
Estimate how long following the path will take in the best case, assuming no traffic or delay at intersections. To determine the speed along each step, the agent’s optional max_speed must be known.
sourcepub fn get_blocked_starts(&self) -> Vec<LaneID>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_blocked_starts(&self) -> Vec<LaneID>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
If the agent following this path will initially block some intermediate lanes as they move
between a driveway and get_req().start
, then record them here.
sourcepub fn get_total_elevation_change(&self, map: &Map) -> (Distance, Distance)
pub fn get_total_elevation_change(&self, map: &Map) -> (Distance, Distance)
Returns the total elevation (gain, loss) experienced over the path.
pub fn get_step_at_dist_along(
&self,
map: &Map,
dist_along: Distance
) -> Result<PathStep>
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Path
impl<'de> Deserialize<'de> for Path
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
impl StructuralPartialEq for Path
Auto Trait Implementations
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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