1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (C) 2017 Kisio Digital and/or its affiliates.
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Affero General Public License as published by the
// Free Software Foundation, version 3.

// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details.

// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>

//! The `transit_model` crate proposes a model to manage transit data.
//! It can import and export data from
//! [GTFS](https://gtfs.org/reference/static) and
//! [NTFS](https://github.com/CanalTP/ntfs-specification/blob/master/ntfs_fr.md).
//!
//! # Features
//! `transit_model` has 2 possible features: `proj` and `xmllint`.
//!
//! ## `proj`
//! `proj` feature is used for geolocation conversion (see
//! [Proj]). `proj` feature is used, for example, to export NeTEx France format.
//!
//! [Proj]: https://proj.org
//!
//! ## `xmllint`
//! Most likely, you don't need this feature as it's only used for additional
//! tests. It doesn't add any functionality to `transit_model`. If you're a
//! contributor to the project, you might be interested to run these tests. In
//! this case, take a look at the [`CONTRIBUTING.md`] for more information on
//! this feature.
//!
//! [`CONTRIBUTING.md`]: https://github.com/CanalTP/transit_model/blob/master/CONTRIBUTING.md

#![deny(missing_docs)]

#[macro_use]
mod utils;
mod add_prefix;
pub use add_prefix::{AddPrefix, PrefixConfiguration};
pub mod calendars;
#[macro_use]
pub mod objects;
pub mod gtfs;
pub mod model;
#[cfg(feature = "proj")]
pub mod netex_france;
pub mod netex_utils;
pub mod ntfs;
pub mod read_utils;
#[doc(hidden)]
pub mod test_utils;
pub mod transfers;
pub mod validity_period;
pub mod vptranslator;

/// Current version of the NTFS format
pub const NTFS_VERSION: &str = "0.11.2";

/// The max distance in meters to compute the transfer
pub const TRANSFER_MAX_DISTANCE: &str = "300";

/// The walking speed in meters per second
pub const TRANSFER_WAKING_SPEED: &str = "0.785";

/// Waiting time at stop in second
pub const TRANSFER_WAITING_TIME: &str = "60";

lazy_static::lazy_static! {
    /// Current datetime
    pub static ref CURRENT_DATETIME: String = chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
}

/// The error type used by the crate.
pub type Error = failure::Error;

/// The corresponding result type used by the crate.
pub type Result<T> = std::result::Result<T, Error>;

pub use crate::model::Model;