5353//! calculations.
5454
5555use std:: cmp:: Ordering ;
56- use std:: convert:: Infallible ;
5756
5857use dimensioned:: si:: { M , Meter } ;
5958#[ cfg( feature = "rayon" ) ]
@@ -79,8 +78,6 @@ pub enum CourseError {
7978 Algorithm ( #[ from] AlgorithmError ) ,
8079 #[ error( "Distance is NaN" ) ]
8180 NaNDistance ,
82- #[ error( "Infallible" ) ]
83- Infallible ( #[ from] Infallible ) ,
8481}
8582
8683type Result < T > = std:: result:: Result < T , CourseError > ;
@@ -163,7 +160,7 @@ pub struct CourseSet {
163160/// Builds routes and waypoints into courses with associated course points
164161pub struct CourseSetBuilder {
165162 options : CourseSetOptions ,
166- course_builders : Vec < RouteBuilder > ,
163+ route_builders : Vec < RouteBuilder > ,
167164 waypoints : Vec < Waypoint > ,
168165}
169166
@@ -172,19 +169,19 @@ impl CourseSetBuilder {
172169 pub fn new ( options : CourseSetOptions ) -> Self {
173170 Self {
174171 options,
175- course_builders : Vec :: new ( ) ,
172+ route_builders : Vec :: new ( ) ,
176173 waypoints : Vec :: new ( ) ,
177174 }
178175 }
179176
180177 /// Adds a new [`RouteBuilder`] to this set builder.
181178 pub fn add_route ( & mut self ) -> & mut RouteBuilder {
182- self . course_builders . push ( RouteBuilder :: new ( ) ) ;
183- self . last_course_mut ( ) . unwrap ( )
179+ self . route_builders . push ( RouteBuilder :: new ( ) ) ;
180+ self . last_route_mut ( ) . unwrap ( )
184181 }
185182
186- pub fn last_course_mut ( & mut self ) -> Result < & mut RouteBuilder > {
187- match self . course_builders . last_mut ( ) {
183+ pub fn last_route_mut ( & mut self ) -> Result < & mut RouteBuilder > {
184+ match self . route_builders . last_mut ( ) {
188185 Some ( course) => Ok ( course) ,
189186 None => Err ( CourseError :: MissingCourse ) ,
190187 }
@@ -195,16 +192,16 @@ impl CourseSetBuilder {
195192 self
196193 }
197194
198- pub fn num_courses ( & self ) -> usize {
199- self . course_builders . len ( )
195+ pub fn num_routes ( & self ) -> usize {
196+ self . route_builders . len ( )
200197 }
201198
202199 /// Build the courses.
203200 ///
204201 /// The geodesic calculations happen in here.
205202 pub fn build ( mut self ) -> Result < CourseSet > {
206203 let mut courses = Vec :: new ( ) ;
207- let mut course_builders = std:: mem:: take ( & mut self . course_builders ) ;
204+ let mut course_builders = std:: mem:: take ( & mut self . route_builders ) ;
208205 let mut segmented_courses = course_builders
209206 . iter_mut ( )
210207 . map ( |c| c. segment ( ) )
0 commit comments