Struct transit_model::model::Model[][src]

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

The navitia transit model.

Implementations

impl Model[src]

pub fn get_corresponding<T, U>(&self, from: &IdxSet<T>) -> IdxSet<U> where
    IdxSet<T>: GetCorresponding<U>, 
[src]

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

pub fn get_corresponding_from_idx<T, U>(&self, from: Idx<T>) -> IdxSet<U> where
    IdxSet<T>: GetCorresponding<U>, 
[src]

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

impl Model[src]

pub fn new(c: Collections) -> Result<Self>[src]

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());

pub fn into_collections(self) -> Collections[src]

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>

pub fn calculate_validity_period(&self) -> Result<(Date, Date)>[src]

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

impl Deref for Model[src]

type Target = Collections

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<'de> Deserialize<'de> for Model[src]

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Model[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

impl RefUnwindSafe for Model

impl Send for Model

impl Sync for Model

impl Unpin for Model

impl UnwindSafe for Model

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]