pub struct NavigationController { /* private fields */ }
Expand description
Manages the navigation lifecycle through a route, returning an updated state given inputs like user location.
Notes for implementing a new platform:
- A controller is bound to a single route; if you want recalculation, create a new instance.
- This is a pure type (no interior mutability), so a core function of your platform code is responsibly managing mutable state.
Implementations§
Sourcepub fn new(route: Route, config: NavigationControllerConfig) -> Self
pub fn new(route: Route, config: NavigationControllerConfig) -> Self
Create a navigation controller for a route and configuration.
Trait Implementations§
type LiftType = Arc<NavigationController>
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§type ReturnType = <Arc<NavigationController> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<NavigationController> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§fn get_initial_state(&self, location: UserLocation) -> NavState
fn get_initial_state(&self, location: UserLocation) -> NavState
Returns initial trip state as if the user had just started the route with no progress.
Source§fn advance_to_next_step(&self, state: NavState) -> NavState
fn advance_to_next_step(&self, state: NavState) -> NavState
Advances navigation to the next step (or finishes the route).
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.
This method takes the intermediate state (e.g., from update_user_location
) and advances if necessary,
and does not handle anything like snapping.
Source§fn update_user_location(
&self,
location: UserLocation,
state: NavState,
) -> NavState
fn update_user_location( &self, location: UserLocation, state: NavState, ) -> NavState
Updates the user’s current location and updates the navigation state accordingly.
§Panics
If there is no current step (TripState::Navigating
has an empty remainingSteps
value),
this function will panic.
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, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for 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