pub struct Model { /* private fields */ }
Expand description

The navitia transit model.

Implementations

Returns the set of U indices corresponding to the from set.

Returns the set of U indices corresponding to the from index.

Constructs a model from the given Collections. Fails in case of incoherence, as invalid external references.

Examples
let _: Model = Model::new(Collections::default())?;
let mut collections = Collections::default();
// This transfer is invalid as there is no stop points in collections
// but objects not referenced are removed from the model
collections.transfers = Collection::from(Transfer {
    from_stop_id: "invalid".into(),
    to_stop_id: "also_invalid".into(),
    min_transfer_time: None,
    real_min_transfer_time: None,
    equipment_id: None,
});
assert!(Model::new(collections).is_ok());

Consumes collections,

Examples
let model: Model = Model::new(Collections::default())?;
let mut collections = model.into_collections();
 collections
   .feed_infos
   .insert("foo".to_string(), "bar".to_string());
let feeds: Vec<(_, _)> = collections.feed_infos.into_iter().collect();
assert_eq!(
   vec![("foo".to_string(), "bar".to_string())],
   feeds
);

Methods from Deref<Target = Collections>

Calculate the validity period in the ‘Model’. The calculation is based on the minimum start date and the maximum end date of all the datasets. If no dataset is found, an error is returned.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more