Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the GAT syntax #7

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mapf/src/directed/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<V: std::fmt::Debug + Clone> crate::Graph for SimpleGraph<V> {
type Vertex = V;
type Edge = (usize, usize);

type EdgeIter<'a> where Self: 'a = impl Iterator<Item=(usize, usize)> + 'a;
type EdgeIter<'a> = impl Iterator<Item=(usize, usize)> + 'a where Self: 'a;

fn vertex (&self, key: usize) -> Option<V> {
self.vertices.get(key).cloned()
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/expander/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<E: Expander, C: Expander<Node=E::Node>> Expander for Chain<E, C> {

impl<E: Targeted<G>, C: Targeted<G, Node=E::Node>, G: Goal<E::Node>> Targeted<G> for Chain<E, C> {
type TargetedError = ChainErr<E::TargetedError, C::TargetedError>;
type TargetedExpansion<'a> where Self: 'a, G: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a where Self: 'a, G: 'a;

fn expand<'a>(
&'a self,
Expand All @@ -62,7 +62,7 @@ where
G: Goal<E::Node>,
{
type InitTargetedError = E::InitTargetedError;
type InitialTargetedNodes<'a> where Self: 'a, S: 'a, G: 'a = E::InitialTargetedNodes<'a>;
type InitialTargetedNodes<'a> = E::InitialTargetedNodes<'a> where Self: 'a, S: 'a, G: 'a;

fn start<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/expander/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ where
F: Fn(&Arc<N>, &G) -> Exp
{
type TargetedError = Err;
type TargetedExpansion<'a> where Self: 'a = Exp;
type TargetedExpansion<'a> = Exp where Self: 'a;

fn expand<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/expander/constrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<E: Expander, C> Expander for Constrain<E, C> {

impl<E: Targeted<G>, C: TargetedConstraint<E::Node, G>, G: Goal<E::Node>> Targeted<G> for Constrain<E, C> {
type TargetedError = ConstrainErr<E::TargetedError, C::ConstraintError>;
type TargetedExpansion<'a> where Self: 'a, G: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::TargetedError>> + 'a where Self: 'a, G: 'a ;

fn expand<'a>(
&'a self,
Expand All @@ -77,7 +77,7 @@ where
G: Goal<E::Node>,
{
type InitTargetedError = ConstrainErr<E::InitTargetedError, C::ConstraintError>;
type InitialTargetedNodes<'a> where Self: 'a, S: 'a, G: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>> + 'a;
type InitialTargetedNodes<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>> + 'a where Self: 'a, S: 'a, G: 'a;

fn start<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
#![feature(generic_associated_types, associated_type_bounds, type_alias_impl_trait)]
#![feature(associated_type_bounds, type_alias_impl_trait)]

pub mod progress;

Expand Down
4 changes: 2 additions & 2 deletions mapf/src/motion/graph_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ where
P::Reach: Reachable<P::Node, G, P::Waypoint>,
{
type TargetedError = ExpansionErrorOf<P, G>;
type TargetedExpansion<'a> where P: 'a, G: 'a = impl Iterator<Item=Result<Arc<P::Node>, ExpansionErrorOf<P, G>>> + 'a;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<P::Node>, ExpansionErrorOf<P, G>>> + 'a where P: 'a, G: 'a ;

fn expand<'a>(
&'a self,
Expand Down Expand Up @@ -338,7 +338,7 @@ where

impl<P: Policy> Aimless for Expander<P> {
type AimlessError = ExtrapolatorErrorOf<P>;
type AimlessExpansion<'a> where P: 'a = impl Iterator<Item=Result<Arc<P::Node>, Self::AimlessError>> + 'a;
type AimlessExpansion<'a> = impl Iterator<Item=Result<Arc<P::Node>, Self::AimlessError>> + 'a where P: 'a;

fn aimless_expand<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/motion/hold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<W: Waypoint, C: CostCalculator<W>, N> Expander for Hold<W, C, N> {

impl<W: Waypoint, C: CostCalculator<W, Cost=N::Cost>, N: Informed + Movable<W>, G: Goal<N>> Targeted<G> for Hold<W, C, N> {
type TargetedError = NoError;
type TargetedExpansion<'a> where W: 'a, N: 'a, C: 'a, G: 'a = impl Iterator<Item=Result<Arc<N>, NoError>>;
type TargetedExpansion<'a> = impl Iterator<Item=Result<Arc<N>, NoError>> where W: 'a, N: 'a, C: 'a, G: 'a ;

fn expand<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/motion/r2/graph_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ where
H: Heuristic<G::Key, G::Key, C::Cost>,
{
type InitAimlessError = InitErrorR2<G::Key, H::Error>;
type InitialAimlessNodes<'a> where G: 'a, C: 'a, H: 'a, S: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitAimlessError>>;
type InitialAimlessNodes<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitAimlessError>> + 'a where G: 'a, C: 'a, H: 'a, S: 'a;

fn aimless_start<'a>(
&'a self,
Expand Down Expand Up @@ -141,7 +141,7 @@ where
H: Heuristic<G::Key, G::Key, C::Cost>,
{
type InitTargetedError = InitErrorR2<G::Key, H::Error>;
type InitialTargetedNodes<'a> where G: 'a, C: 'a, H: 'a, S: 'a = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>>;
type InitialTargetedNodes<'a> = impl Iterator<Item=Result<Arc<Self::Node>, Self::InitTargetedError>> + 'a where G: 'a, C: 'a, H: 'a, S: 'a ;

fn start<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion mapf/src/motion/reach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub trait Reachable<Node, Goal, W: Waypoint> {
pub struct NoReach;
impl<N, G, W: Waypoint> Reachable<N, G, W> for NoReach {
type ReachError = NoError;
type Reaching<'a> where N: 'a, G: 'a, W: 'a = impl Iterator<Item=Result<Trajectory<W>, NoError>>;
type Reaching<'a> = impl Iterator<Item=Result<Trajectory<W>, NoError>> where N: 'a, G: 'a, W: 'a ;

fn reach_for<'a>(&'a self, _: &'a N, _: &'a G) -> Self::Reaching<'a> {
[].into_iter()
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/motion/se2/graph_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub struct ReachForLinearSE2 {

impl<GraphKey: Key, const RESOLUTION: u64> Reachable<Node<GraphKey, RESOLUTION>, GoalSE2<GraphKey>, se2::timed_position::Waypoint> for ReachForLinearSE2 {
type ReachError = NoError;
type Reaching<'a> = impl Iterator<Item=Result<se2::LinearTrajectory, NoError>>;
type Reaching<'a> = impl Iterator<Item=Result<se2::LinearTrajectory, NoError>> + 'a;

fn reach_for<'a>(&'a self, parent: &'a Node<GraphKey, RESOLUTION>, goal: &'a GoalSE2<GraphKey>) -> Self::Reaching<'a> {
[parent].into_iter()
Expand Down Expand Up @@ -298,7 +298,7 @@ where
H: Heuristic<KeySE2<G::Key, RESOLUTION>, GoalSE2<G::Key>, i64>,
{
type InitTargetedError = InitErrorSE2<H::Error>;
type InitialTargetedNodes<'a> where G: 'a, C: 'a, H: 'a, S: 'a = impl Iterator<Item=Result<Arc<Node<G::Key, RESOLUTION>>, Self::InitTargetedError>> + 'a;
type InitialTargetedNodes<'a> = impl Iterator<Item=Result<Arc<Node<G::Key, RESOLUTION>>, Self::InitTargetedError>> + 'a where G: 'a, C: 'a, H: 'a, S: 'a;

fn start<'a>(
&'a self,
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/node/closed_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<N: Weighted + PartialKeyed> Default for PartialKeyedClosedSet<N> {
}

impl<N: Weighted + PartialKeyed> ClosedSet<N> for PartialKeyedClosedSet<N> {
type Iter<'a> where N: 'a = impl Iterator<Item=&'a Arc<N>> + 'a;
type Iter<'a> = impl Iterator<Item=&'a Arc<N>> + 'a where N: 'a;

fn close(&mut self, node: &Arc<N>) -> CloseResult<N> {
if let Some(key) = node.partial_key() {
Expand Down Expand Up @@ -169,7 +169,7 @@ impl<N: Weighted + PartialKeyed + Timed> Default for TimeVariantPartialKeyedClos
}

impl<N: Weighted + PartialKeyed + Timed> ClosedSet<N> for TimeVariantPartialKeyedClosetSet<N> {
type Iter<'a> where N: 'a = impl Iterator<Item=&'a Arc<N>> + 'a;
type Iter<'a> = impl Iterator<Item=&'a Arc<N>> + 'a where N: 'a ;

fn close(&mut self, node: &Arc<N>) -> CloseResult<N> {
if let Some(key) = node.partial_key() {
Expand Down
4 changes: 2 additions & 2 deletions mapf/src/occupancy/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<G: Grid> Graph for VisibilityGraph<G> {
type Key = Cell;
type Vertex = Point;
type Edge = (Cell, Cell);
type EdgeIter<'a> where Self: 'a = impl Iterator<Item=(Cell, Cell)> + 'a;
type EdgeIter<'a> = impl Iterator<Item=(Cell, Cell)> + 'a where Self: 'a;

fn vertex(&self, cell: Self::Key) -> Option<Self::Vertex> {
// We don't bother to filter out occupied cells because those cells will
Expand Down Expand Up @@ -162,7 +162,7 @@ impl<G: Grid> Graph for NeighborhoodGraph<G> {
type Key = Cell;
type Vertex = Point;
type Edge = (Cell, Cell);
type EdgeIter<'a> where Self: 'a = impl Iterator<Item=(Cell, Cell)> + 'a;
type EdgeIter<'a> = impl Iterator<Item=(Cell, Cell)> + 'a where Self: 'a;

fn vertex(&self, cell: Self::Key) -> Option<Self::Vertex> {
if self.visibility.grid().is_occupied(&cell) {
Expand Down