google_maps/distance_matrix/request/with_arrival_time.rs
1use chrono::NaiveDateTime;
2
3// -----------------------------------------------------------------------------
4
5impl crate::distance_matrix::Request<'_> {
6    /// Specifies the desired arrival time.
7    ///
8    /// ## Arguments
9    ///
10    /// * `arrival_time` ‧ The time the passenger should arrive at their final
11    ///   destination by.
12    ///
13    /// ## Description
14    ///
15    /// Specifies the desired time of arrival for _transit_ distances. You can
16    /// use either the `.with_departure_time()` or the `.with_arrival_time()`
17    /// method, but not both together.
18    ///
19    /// ## Example
20    ///
21    /// * Arriving by January 1, 2019 at 12:00:00 AM:
22    /// ```rust
23    /// .with_arrival_time(NaiveDate::from_ymd(2019, 1, 1).and_hms(0, 00, 0))
24    /// ```
25    #[must_use] pub fn with_arrival_time(
26        mut self,
27        arrival_time: impl Into<NaiveDateTime>
28    ) -> Self {
29        let arrival_time: NaiveDateTime = arrival_time.into();
30        self.arrival_time = Some(arrival_time);
31        self
32    } // fn
33} // impl