Skip to content

Commit 832020e

Browse files
committed
add code documentation
1 parent b1943c2 commit 832020e

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/geometry_from_osm.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ fn read_osm(input_file: &str, lrm_tag: &str) -> (Vec<osm4routing::Node>, Vec<osm
2222

2323
#[derive(Parser, Debug)]
2424
#[command(version, about, long_about = None)]
25+
/// Arguments given by the command line interface.
2526
struct Args {
26-
/// OpenStreetMap file to parse
27+
/// OpenStreetMap file to parse.
2728
#[arg(short, long)]
2829
input_osm_file: String,
2930

30-
/// Output file where the LRS will be written
31+
/// Output file where the [`Lrs`] will be written.
3132
#[arg(short, long)]
3233
output_lrs: String,
3334

34-
/// OpenStreetMap tag identifying the lrm. For the french railway network use ref:FR:SNCF_Reseau
35+
/// OpenStreetMap tag identifying the LRM. The french railway network uses `ref:FR:SNCF_Reseau`.
3536
#[arg(short, long)]
3637
lrm_tag: String,
3738
}
@@ -40,7 +41,7 @@ fn main() {
4041
let cli_args = Args::parse();
4142
let (nodes, edges) = read_osm(&cli_args.input_osm_file, &cli_args.lrm_tag);
4243
println!(
43-
"In OpenStreetMap, we have {} nodes and {} edges",
44+
"In OpenStreetMap, we have {} nodes and {} edges.",
4445
nodes.len(),
4546
edges.len()
4647
);
@@ -93,7 +94,7 @@ fn main() {
9394
})
9495
.collect();
9596

96-
println!("In the LRS we have {} traversals", traversals.len());
97+
println!("In the LRS, we have {} traversals.", traversals.len());
9798

9899
let nodes: Vec<_> = nodes
99100
.iter()

src/lrs.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ pub struct LrmHandle(usize);
2323
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
2424
pub struct TraversalHandle(usize);
2525

26-
/// Represents an Linear Reference Method (LRM)
27-
/// It is the combination of one (or more) [`Traversals`] for one [`LrmScale`]
26+
/// Represents an Linear Reference Method (LRM).
27+
/// It is the combination of one (or more) [`Traversal`]s for one [`LrmScale`].
2828
pub struct Lrm {
29-
/// The scale of the LRM
29+
/// The scale of this [`Lrm`].
3030
pub scale: LrmScale,
31-
/// Traversal that is the reference of this LRM
31+
/// The [`Traversal`] that is the reference of this [`Lrm`].
3232
pub reference_traversal: TraversalHandle,
33-
/// All the traversals where this LRM applies
33+
/// All the [`Traversal`]s where this [`Lrm`] applies.
3434
pub traversals: Vec<TraversalHandle>,
3535
}
3636

37-
/// A traversal is path in the network that ends [`Curve`]
38-
/// That traversals can be used for many different [`Lrm`]
37+
/// A [`Traversal`] is path in the network that ends [`Curve`].
38+
/// That [`Traversal`]s can be used for many different [`Lrm`]s.
3939
struct Traversal<CurveImpl: Curve> {
40-
/// Identifies the traversal
40+
/// Identifies this [`Traversal`].
4141
id: String,
42-
/// The geometrical curve of the traversal
42+
/// The geometrical [`Curve`] of this [`Traversal`].
4343
curve: CurveImpl,
44-
/// All the [`Lrm`] that use this traversal
44+
/// All the [`Lrm`]s that use this [`Traversal`].
4545
lrms: Vec<LrmHandle>,
4646
}
4747

@@ -261,7 +261,7 @@ pub enum LrsError {
261261
InvalidArchive,
262262
}
263263

264-
/// The basic functions to manipulate the LRS
264+
/// The basic functions to manipulate the [`Lrs`].
265265
pub trait LrsBase {
266266
/// Returns the [`LrmHandle`] (if it exists) of the [`Lrm`] identified by its `lrm_id`.
267267
fn get_lrm(&self, lrm_id: &str) -> Option<LrmHandle>;

0 commit comments

Comments
 (0)