11use std:: {
22 fs:: { DirEntry , File } ,
3+ num:: NonZeroU64 ,
34 path:: { Path , PathBuf } ,
45} ;
56
@@ -100,7 +101,7 @@ pub fn run(
100101 let ( mmfc, tlfc) = get_constraint_model_arguments ( & compass_conf) ?;
101102 let time_limit = tlfc. time_limit . clone ( ) ;
102103 let constraints = mmfc. constraints . clone ( ) ;
103- let max_trip_legs = mmfc. max_trip_legs as usize ;
104+ let max_trip_legs = mmfc. max_trip_legs ;
104105
105106 log:: info!( "finding metadata files in {directory}" ) ;
106107 let read_dir = std:: fs:: read_dir ( directory) . map_err ( |e| GtfsConfigError :: ReadError {
@@ -383,7 +384,7 @@ pub fn gtfs_traversal_model_config(
383384 edges_metadata : & str ,
384385 available_modes : & [ String ] ,
385386 fq_route_ids_filepath : & Path ,
386- max_trip_legs : usize ,
387+ max_trip_legs : NonZeroU64 ,
387388) -> Result < serde_json:: Value , GtfsConfigError > {
388389 let route_ids_input_file = Some ( fq_route_ids_filepath. to_string_lossy ( ) . to_string ( ) ) ;
389390 let dtc_conf = DistanceTraversalConfig {
@@ -400,7 +401,7 @@ pub fn gtfs_traversal_model_config(
400401 this_mode : "transit" . to_string ( ) ,
401402 available_modes : available_modes. to_vec ( ) ,
402403 route_ids_input_file : Some ( fq_route_ids_filepath. to_string_lossy ( ) . to_string ( ) ) ,
403- max_trip_legs : max_trip_legs as u64 ,
404+ max_trip_legs,
404405 } ;
405406 let dtc = as_json_with_type_tag ( & dtc_conf, "distance" ) ?;
406407 let ttc = as_json_with_type_tag ( & ttc_conf, "transit" ) ?;
@@ -419,14 +420,14 @@ pub fn gtfs_constraint_model_config(
419420 time_limit : & TimeLimitConfig ,
420421 available_modes : & [ String ] ,
421422 fq_route_ids_filepath : & Path ,
422- max_trip_legs : usize ,
423+ max_trip_legs : NonZeroU64 ,
423424) -> Result < serde_json:: Value , GtfsConfigError > {
424425 let mmc_conf = MultimodalConstraintConfig {
425426 this_mode : "transit" . to_string ( ) ,
426427 constraints : constraints. to_vec ( ) ,
427428 available_modes : available_modes. to_vec ( ) ,
428429 route_ids_input_file : Some ( fq_route_ids_filepath. to_string_lossy ( ) . to_string ( ) ) ,
429- max_trip_legs : max_trip_legs as u64 ,
430+ max_trip_legs,
430431 } ;
431432 let tlm = as_json_with_type_tag ( time_limit, "time_limit" ) ?;
432433 let mmc = as_json_with_type_tag ( & mmc_conf, "multimodal" ) ?;
0 commit comments