Struct vrp_core::construction::heuristics::RegistryContext
source · pub struct RegistryContext { /* private fields */ }
Expand description
Keeps track on how routes are used.
Implementations§
source§impl RegistryContext
impl RegistryContext
sourcepub fn new(goal: &GoalContext, registry: Registry) -> Self
pub fn new(goal: &GoalContext, registry: Registry) -> Self
Creates a new instance of RouteRegistry
.
sourcepub fn next_route(&self) -> impl Iterator<Item = &RouteContext>
pub fn next_route(&self) -> impl Iterator<Item = &RouteContext>
Returns next route available for insertion.
sourcepub fn get_route(&mut self, actor: &Actor) -> Option<RouteContext>
pub fn get_route(&mut self, actor: &Actor) -> Option<RouteContext>
Gets route for given actor and marks it as used. Returns None if actor is already in use. NOTE: you need to call free route to make it to be available again.
sourcepub fn free_route(&mut self, route: RouteContext) -> bool
pub fn free_route(&mut self, route: RouteContext) -> bool
Return back route to be reused again. Returns whether the route was not present in the registry.
sourcepub fn deep_slice(&self, filter: impl Fn(&Actor) -> bool) -> Self
pub fn deep_slice(&self, filter: impl Fn(&Actor) -> bool) -> Self
Creates a deep sliced copy of RegistryContext
keeping only specific actors data.
Auto Trait Implementations§
impl Freeze for RegistryContext
impl !RefUnwindSafe for RegistryContext
impl Send for RegistryContext
impl Sync for RegistryContext
impl Unpin for RegistryContext
impl !UnwindSafe for RegistryContext
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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