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

feat: re-export external types from the API as part of the API #923

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Hove <[email protected]>", "Guillaume Pinot <[email protected]>"]
name = "transit_model"
version = "0.58.1"
version = "0.59.0"
license = "AGPL-3.0-only"
description = "Transit data management"
repository = "https://github.com/hove-io/transit_model"
Expand Down Expand Up @@ -36,6 +36,7 @@ members = [
xmllint = ["proj"]
gtfs = []
parser = []
typed-index-collection-expose-inner = ["typed_index_collection/expose-inner"]

[dependencies]
anyhow = "1"
Expand Down
25 changes: 25 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,31 @@ pub mod validity_period;
mod version_utils;
pub mod vptranslator;

// Re-export sub-types that are part of `transit_model` API
// Useful because user won't need to depend on a third party dependency
// and find the correct version to make it work.
pub use relational_types::{IdxSet, Relation};
pub use typed_index_collection::{
Collection, CollectionWithId, Id, Idx, Iter as TypedIndexCollectionIter, WithId,
};
/// Re-export `chrono` types that are part of `transit_model` API
pub mod chrono {
pub use chrono::{DateTime, FixedOffset};
pub(crate) use chrono::{SecondsFormat, Utc};
}
/// Re-export `geo` types that are part of `transit_model` API
pub mod geo {
pub use geo::geometry::Geometry;
}
/// Re-export `minidom` types that are part of `transit_model` API
pub mod minidom {
pub use minidom::Element;
}
/// Re-export `rust_decimal` types that are part of `transit_model` API
pub mod rust_decimal {
pub use rust_decimal::Decimal;
}

// Good average size for initialization of the `StopTime` collection in `VehicleJourney`
// Note: they are shrinked down in `Model::new()` to fit the real size
pub(crate) const STOP_TIMES_INIT_CAPACITY: usize = 50;
Expand Down