pub struct NavigationController { /* private fields */ }
Expand description
Manages the navigation lifecycle of a route, reacting to inputs like user location updates and returning a new state. If you want to recalculate a new route, you need to create a new navigation controller.
In the overall architecture, this is a mid-level construct. It wraps some lower level constructs like the route adapter, but a higher level wrapper handles things like feeding in user location updates, route recalculation behavior, etc.
Implementations§
pub fn new(route: Route, config: NavigationControllerConfig) -> Self
sourcepub fn get_initial_state(&self, location: UserLocation) -> TripState
pub fn get_initial_state(&self, location: UserLocation) -> TripState
Returns initial trip state as if the user had just started the route with no progress.
sourcepub fn advance_to_next_step(&self, state: &TripState) -> TripState
pub fn advance_to_next_step(&self, state: &TripState) -> TripState
Advances navigation to the next step.
Depending on the advancement strategy, this may be automatic. For other cases, it is desirable to advance to the next step manually (ex: walking in an urban tunnel). We leave this decision to the app developer and provide this as a convenience.
sourcepub fn update_user_location(
&self,
location: UserLocation,
state: &TripState
) -> TripState
pub fn update_user_location( &self, location: UserLocation, state: &TripState ) -> TripState
Updates the user’s current location and updates the navigation state accordingly.
Trait Implementations§
type LiftType = Arc<NavigationController>
§type ReturnType = <NavigationController as FfiConverterArc<UniFfiTag>>::FfiType
type ReturnType = <NavigationController as FfiConverterArc<UniFfiTag>>::FfiType
source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustBuffer>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustBuffer>
const TYPE_ID_META: MetadataBuffer = _
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more