1#![forbid(unsafe_code)]
2#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))]
3#[allow(unused_imports)]
4pub use progenitor_client::{ByteStream, ClientInfo, Error, ResponseValue};
5use progenitor_client::{ClientHooks, OperationInfo, RequestBuilderExt, encode_path};
6#[allow(clippy::all)]
8pub mod types {
9 pub mod error {
11 pub struct ConversionError(::std::borrow::Cow<'static, str>);
13 impl ::std::error::Error for ConversionError {}
14 impl ::std::fmt::Display for ConversionError {
15 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
16 ::std::fmt::Display::fmt(&self.0, f)
17 }
18 }
19
20 impl ::std::fmt::Debug for ConversionError {
21 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
22 ::std::fmt::Debug::fmt(&self.0, f)
23 }
24 }
25
26 impl From<&'static str> for ConversionError {
27 fn from(value: &'static str) -> Self {
28 Self(value.into())
29 }
30 }
31
32 impl From<String> for ConversionError {
33 fn from(value: String) -> Self {
34 Self(value.into())
35 }
36 }
37 }
38
39 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
146 pub struct Alert {
147 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
148 pub cause: ::std::option::Option<AlertCause>,
149 #[serde(
152 rename = "causeDetail",
153 default,
154 skip_serializing_if = "::std::option::Option::is_none"
155 )]
156 pub cause_detail: ::std::option::Option<::std::string::String>,
157 #[serde(
162 rename = "communicationPeriod",
163 default,
164 skip_serializing_if = "::std::vec::Vec::is_empty"
165 )]
166 pub communication_period: ::std::vec::Vec<TimeRange>,
167 #[serde(rename = "descriptionText")]
173 pub description_text: ::std::string::String,
174 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
175 pub effect: ::std::option::Option<AlertEffect>,
176 #[serde(
179 rename = "effectDetail",
180 default,
181 skip_serializing_if = "::std::option::Option::is_none"
182 )]
183 pub effect_detail: ::std::option::Option<::std::string::String>,
184 #[serde(rename = "headerText")]
187 pub header_text: ::std::string::String,
188 #[serde(
193 rename = "imageAlternativeText",
194 default,
195 skip_serializing_if = "::std::option::Option::is_none"
196 )]
197 pub image_alternative_text: ::std::option::Option<::std::string::String>,
198 #[serde(
201 rename = "imageMediaType",
202 default,
203 skip_serializing_if = "::std::option::Option::is_none"
204 )]
205 pub image_media_type: ::std::option::Option<::std::string::String>,
206 #[serde(
208 rename = "imageUrl",
209 default,
210 skip_serializing_if = "::std::option::Option::is_none"
211 )]
212 pub image_url: ::std::option::Option<::std::string::String>,
213 #[serde(
216 rename = "impactPeriod",
217 default,
218 skip_serializing_if = "::std::vec::Vec::is_empty"
219 )]
220 pub impact_period: ::std::vec::Vec<TimeRange>,
221 #[serde(
222 rename = "severityLevel",
223 default,
224 skip_serializing_if = "::std::option::Option::is_none"
225 )]
226 pub severity_level: ::std::option::Option<AlertSeverityLevel>,
227 #[serde(
234 rename = "ttsDescriptionText",
235 default,
236 skip_serializing_if = "::std::option::Option::is_none"
237 )]
238 pub tts_description_text: ::std::option::Option<::std::string::String>,
239 #[serde(
245 rename = "ttsHeaderText",
246 default,
247 skip_serializing_if = "::std::option::Option::is_none"
248 )]
249 pub tts_header_text: ::std::option::Option<::std::string::String>,
250 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
252 pub url: ::std::option::Option<::std::string::String>,
253 }
254
255 impl ::std::convert::From<&Alert> for Alert {
256 fn from(value: &Alert) -> Self {
257 value.clone()
258 }
259 }
260
261 impl Alert {
262 pub fn builder() -> builder::Alert {
263 Default::default()
264 }
265 }
266
267 #[derive(
293 :: serde :: Deserialize,
294 :: serde :: Serialize,
295 Clone,
296 Copy,
297 Debug,
298 Eq,
299 Hash,
300 Ord,
301 PartialEq,
302 PartialOrd,
303 )]
304 pub enum AlertCause {
305 #[serde(rename = "UNKNOWN_CAUSE")]
306 UnknownCause,
307 #[serde(rename = "OTHER_CAUSE")]
308 OtherCause,
309 #[serde(rename = "TECHNICAL_PROBLEM")]
310 TechnicalProblem,
311 #[serde(rename = "STRIKE")]
312 Strike,
313 #[serde(rename = "DEMONSTRATION")]
314 Demonstration,
315 #[serde(rename = "ACCIDENT")]
316 Accident,
317 #[serde(rename = "HOLIDAY")]
318 Holiday,
319 #[serde(rename = "WEATHER")]
320 Weather,
321 #[serde(rename = "MAINTENANCE")]
322 Maintenance,
323 #[serde(rename = "CONSTRUCTION")]
324 Construction,
325 #[serde(rename = "POLICE_ACTIVITY")]
326 PoliceActivity,
327 #[serde(rename = "MEDICAL_EMERGENCY")]
328 MedicalEmergency,
329 }
330
331 impl ::std::convert::From<&Self> for AlertCause {
332 fn from(value: &AlertCause) -> Self {
333 value.clone()
334 }
335 }
336
337 impl ::std::fmt::Display for AlertCause {
338 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
339 match *self {
340 Self::UnknownCause => f.write_str("UNKNOWN_CAUSE"),
341 Self::OtherCause => f.write_str("OTHER_CAUSE"),
342 Self::TechnicalProblem => f.write_str("TECHNICAL_PROBLEM"),
343 Self::Strike => f.write_str("STRIKE"),
344 Self::Demonstration => f.write_str("DEMONSTRATION"),
345 Self::Accident => f.write_str("ACCIDENT"),
346 Self::Holiday => f.write_str("HOLIDAY"),
347 Self::Weather => f.write_str("WEATHER"),
348 Self::Maintenance => f.write_str("MAINTENANCE"),
349 Self::Construction => f.write_str("CONSTRUCTION"),
350 Self::PoliceActivity => f.write_str("POLICE_ACTIVITY"),
351 Self::MedicalEmergency => f.write_str("MEDICAL_EMERGENCY"),
352 }
353 }
354 }
355
356 impl ::std::str::FromStr for AlertCause {
357 type Err = self::error::ConversionError;
358 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
359 match value {
360 "UNKNOWN_CAUSE" => Ok(Self::UnknownCause),
361 "OTHER_CAUSE" => Ok(Self::OtherCause),
362 "TECHNICAL_PROBLEM" => Ok(Self::TechnicalProblem),
363 "STRIKE" => Ok(Self::Strike),
364 "DEMONSTRATION" => Ok(Self::Demonstration),
365 "ACCIDENT" => Ok(Self::Accident),
366 "HOLIDAY" => Ok(Self::Holiday),
367 "WEATHER" => Ok(Self::Weather),
368 "MAINTENANCE" => Ok(Self::Maintenance),
369 "CONSTRUCTION" => Ok(Self::Construction),
370 "POLICE_ACTIVITY" => Ok(Self::PoliceActivity),
371 "MEDICAL_EMERGENCY" => Ok(Self::MedicalEmergency),
372 _ => Err("invalid value".into()),
373 }
374 }
375 }
376
377 impl ::std::convert::TryFrom<&str> for AlertCause {
378 type Error = self::error::ConversionError;
379 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
380 value.parse()
381 }
382 }
383
384 impl ::std::convert::TryFrom<&::std::string::String> for AlertCause {
385 type Error = self::error::ConversionError;
386 fn try_from(
387 value: &::std::string::String,
388 ) -> ::std::result::Result<Self, self::error::ConversionError> {
389 value.parse()
390 }
391 }
392
393 impl ::std::convert::TryFrom<::std::string::String> for AlertCause {
394 type Error = self::error::ConversionError;
395 fn try_from(
396 value: ::std::string::String,
397 ) -> ::std::result::Result<Self, self::error::ConversionError> {
398 value.parse()
399 }
400 }
401
402 #[derive(
427 :: serde :: Deserialize,
428 :: serde :: Serialize,
429 Clone,
430 Copy,
431 Debug,
432 Eq,
433 Hash,
434 Ord,
435 PartialEq,
436 PartialOrd,
437 )]
438 pub enum AlertEffect {
439 #[serde(rename = "NO_SERVICE")]
440 NoService,
441 #[serde(rename = "REDUCED_SERVICE")]
442 ReducedService,
443 #[serde(rename = "SIGNIFICANT_DELAYS")]
444 SignificantDelays,
445 #[serde(rename = "DETOUR")]
446 Detour,
447 #[serde(rename = "ADDITIONAL_SERVICE")]
448 AdditionalService,
449 #[serde(rename = "MODIFIED_SERVICE")]
450 ModifiedService,
451 #[serde(rename = "OTHER_EFFECT")]
452 OtherEffect,
453 #[serde(rename = "UNKNOWN_EFFECT")]
454 UnknownEffect,
455 #[serde(rename = "STOP_MOVED")]
456 StopMoved,
457 #[serde(rename = "NO_EFFECT")]
458 NoEffect,
459 #[serde(rename = "ACCESSIBILITY_ISSUE")]
460 AccessibilityIssue,
461 }
462
463 impl ::std::convert::From<&Self> for AlertEffect {
464 fn from(value: &AlertEffect) -> Self {
465 value.clone()
466 }
467 }
468
469 impl ::std::fmt::Display for AlertEffect {
470 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
471 match *self {
472 Self::NoService => f.write_str("NO_SERVICE"),
473 Self::ReducedService => f.write_str("REDUCED_SERVICE"),
474 Self::SignificantDelays => f.write_str("SIGNIFICANT_DELAYS"),
475 Self::Detour => f.write_str("DETOUR"),
476 Self::AdditionalService => f.write_str("ADDITIONAL_SERVICE"),
477 Self::ModifiedService => f.write_str("MODIFIED_SERVICE"),
478 Self::OtherEffect => f.write_str("OTHER_EFFECT"),
479 Self::UnknownEffect => f.write_str("UNKNOWN_EFFECT"),
480 Self::StopMoved => f.write_str("STOP_MOVED"),
481 Self::NoEffect => f.write_str("NO_EFFECT"),
482 Self::AccessibilityIssue => f.write_str("ACCESSIBILITY_ISSUE"),
483 }
484 }
485 }
486
487 impl ::std::str::FromStr for AlertEffect {
488 type Err = self::error::ConversionError;
489 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
490 match value {
491 "NO_SERVICE" => Ok(Self::NoService),
492 "REDUCED_SERVICE" => Ok(Self::ReducedService),
493 "SIGNIFICANT_DELAYS" => Ok(Self::SignificantDelays),
494 "DETOUR" => Ok(Self::Detour),
495 "ADDITIONAL_SERVICE" => Ok(Self::AdditionalService),
496 "MODIFIED_SERVICE" => Ok(Self::ModifiedService),
497 "OTHER_EFFECT" => Ok(Self::OtherEffect),
498 "UNKNOWN_EFFECT" => Ok(Self::UnknownEffect),
499 "STOP_MOVED" => Ok(Self::StopMoved),
500 "NO_EFFECT" => Ok(Self::NoEffect),
501 "ACCESSIBILITY_ISSUE" => Ok(Self::AccessibilityIssue),
502 _ => Err("invalid value".into()),
503 }
504 }
505 }
506
507 impl ::std::convert::TryFrom<&str> for AlertEffect {
508 type Error = self::error::ConversionError;
509 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
510 value.parse()
511 }
512 }
513
514 impl ::std::convert::TryFrom<&::std::string::String> for AlertEffect {
515 type Error = self::error::ConversionError;
516 fn try_from(
517 value: &::std::string::String,
518 ) -> ::std::result::Result<Self, self::error::ConversionError> {
519 value.parse()
520 }
521 }
522
523 impl ::std::convert::TryFrom<::std::string::String> for AlertEffect {
524 type Error = self::error::ConversionError;
525 fn try_from(
526 value: ::std::string::String,
527 ) -> ::std::result::Result<Self, self::error::ConversionError> {
528 value.parse()
529 }
530 }
531
532 #[derive(
550 :: serde :: Deserialize,
551 :: serde :: Serialize,
552 Clone,
553 Copy,
554 Debug,
555 Eq,
556 Hash,
557 Ord,
558 PartialEq,
559 PartialOrd,
560 )]
561 pub enum AlertSeverityLevel {
562 #[serde(rename = "UNKNOWN_SEVERITY")]
563 UnknownSeverity,
564 #[serde(rename = "INFO")]
565 Info,
566 #[serde(rename = "WARNING")]
567 Warning,
568 #[serde(rename = "SEVERE")]
569 Severe,
570 }
571
572 impl ::std::convert::From<&Self> for AlertSeverityLevel {
573 fn from(value: &AlertSeverityLevel) -> Self {
574 value.clone()
575 }
576 }
577
578 impl ::std::fmt::Display for AlertSeverityLevel {
579 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
580 match *self {
581 Self::UnknownSeverity => f.write_str("UNKNOWN_SEVERITY"),
582 Self::Info => f.write_str("INFO"),
583 Self::Warning => f.write_str("WARNING"),
584 Self::Severe => f.write_str("SEVERE"),
585 }
586 }
587 }
588
589 impl ::std::str::FromStr for AlertSeverityLevel {
590 type Err = self::error::ConversionError;
591 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
592 match value {
593 "UNKNOWN_SEVERITY" => Ok(Self::UnknownSeverity),
594 "INFO" => Ok(Self::Info),
595 "WARNING" => Ok(Self::Warning),
596 "SEVERE" => Ok(Self::Severe),
597 _ => Err("invalid value".into()),
598 }
599 }
600 }
601
602 impl ::std::convert::TryFrom<&str> for AlertSeverityLevel {
603 type Error = self::error::ConversionError;
604 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
605 value.parse()
606 }
607 }
608
609 impl ::std::convert::TryFrom<&::std::string::String> for AlertSeverityLevel {
610 type Error = self::error::ConversionError;
611 fn try_from(
612 value: &::std::string::String,
613 ) -> ::std::result::Result<Self, self::error::ConversionError> {
614 value.parse()
615 }
616 }
617
618 impl ::std::convert::TryFrom<::std::string::String> for AlertSeverityLevel {
619 type Error = self::error::ConversionError;
620 fn try_from(
621 value: ::std::string::String,
622 ) -> ::std::result::Result<Self, self::error::ConversionError> {
623 value.parse()
624 }
625 }
626
627 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
669 pub struct Area {
670 #[serde(rename = "adminLevel")]
671 pub admin_level: f64,
672 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
675 pub default: ::std::option::Option<bool>,
676 pub matched: bool,
678 pub name: ::std::string::String,
680 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
684 pub unique: ::std::option::Option<bool>,
685 }
686
687 impl ::std::convert::From<&Area> for Area {
688 fn from(value: &Area) -> Self {
689 value.clone()
690 }
691 }
692
693 impl Area {
694 pub fn builder() -> builder::Area {
695 Default::default()
696 }
697 }
698
699 #[derive(
726 :: serde :: Deserialize,
727 :: serde :: Serialize,
728 Clone,
729 Copy,
730 Debug,
731 Eq,
732 Hash,
733 Ord,
734 PartialEq,
735 PartialOrd,
736 )]
737 pub enum Direction {
738 #[serde(rename = "DEPART")]
739 Depart,
740 #[serde(rename = "HARD_LEFT")]
741 HardLeft,
742 #[serde(rename = "LEFT")]
743 Left,
744 #[serde(rename = "SLIGHTLY_LEFT")]
745 SlightlyLeft,
746 #[serde(rename = "CONTINUE")]
747 Continue,
748 #[serde(rename = "SLIGHTLY_RIGHT")]
749 SlightlyRight,
750 #[serde(rename = "RIGHT")]
751 Right,
752 #[serde(rename = "HARD_RIGHT")]
753 HardRight,
754 #[serde(rename = "CIRCLE_CLOCKWISE")]
755 CircleClockwise,
756 #[serde(rename = "CIRCLE_COUNTERCLOCKWISE")]
757 CircleCounterclockwise,
758 #[serde(rename = "STAIRS")]
759 Stairs,
760 #[serde(rename = "ELEVATOR")]
761 Elevator,
762 #[serde(rename = "UTURN_LEFT")]
763 UturnLeft,
764 #[serde(rename = "UTURN_RIGHT")]
765 UturnRight,
766 }
767
768 impl ::std::convert::From<&Self> for Direction {
769 fn from(value: &Direction) -> Self {
770 value.clone()
771 }
772 }
773
774 impl ::std::fmt::Display for Direction {
775 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
776 match *self {
777 Self::Depart => f.write_str("DEPART"),
778 Self::HardLeft => f.write_str("HARD_LEFT"),
779 Self::Left => f.write_str("LEFT"),
780 Self::SlightlyLeft => f.write_str("SLIGHTLY_LEFT"),
781 Self::Continue => f.write_str("CONTINUE"),
782 Self::SlightlyRight => f.write_str("SLIGHTLY_RIGHT"),
783 Self::Right => f.write_str("RIGHT"),
784 Self::HardRight => f.write_str("HARD_RIGHT"),
785 Self::CircleClockwise => f.write_str("CIRCLE_CLOCKWISE"),
786 Self::CircleCounterclockwise => f.write_str("CIRCLE_COUNTERCLOCKWISE"),
787 Self::Stairs => f.write_str("STAIRS"),
788 Self::Elevator => f.write_str("ELEVATOR"),
789 Self::UturnLeft => f.write_str("UTURN_LEFT"),
790 Self::UturnRight => f.write_str("UTURN_RIGHT"),
791 }
792 }
793 }
794
795 impl ::std::str::FromStr for Direction {
796 type Err = self::error::ConversionError;
797 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
798 match value {
799 "DEPART" => Ok(Self::Depart),
800 "HARD_LEFT" => Ok(Self::HardLeft),
801 "LEFT" => Ok(Self::Left),
802 "SLIGHTLY_LEFT" => Ok(Self::SlightlyLeft),
803 "CONTINUE" => Ok(Self::Continue),
804 "SLIGHTLY_RIGHT" => Ok(Self::SlightlyRight),
805 "RIGHT" => Ok(Self::Right),
806 "HARD_RIGHT" => Ok(Self::HardRight),
807 "CIRCLE_CLOCKWISE" => Ok(Self::CircleClockwise),
808 "CIRCLE_COUNTERCLOCKWISE" => Ok(Self::CircleCounterclockwise),
809 "STAIRS" => Ok(Self::Stairs),
810 "ELEVATOR" => Ok(Self::Elevator),
811 "UTURN_LEFT" => Ok(Self::UturnLeft),
812 "UTURN_RIGHT" => Ok(Self::UturnRight),
813 _ => Err("invalid value".into()),
814 }
815 }
816 }
817
818 impl ::std::convert::TryFrom<&str> for Direction {
819 type Error = self::error::ConversionError;
820 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
821 value.parse()
822 }
823 }
824
825 impl ::std::convert::TryFrom<&::std::string::String> for Direction {
826 type Error = self::error::ConversionError;
827 fn try_from(
828 value: &::std::string::String,
829 ) -> ::std::result::Result<Self, self::error::ConversionError> {
830 value.parse()
831 }
832 }
833
834 impl ::std::convert::TryFrom<::std::string::String> for Direction {
835 type Error = self::error::ConversionError;
836 fn try_from(
837 value: ::std::string::String,
838 ) -> ::std::result::Result<Self, self::error::ConversionError> {
839 value.parse()
840 }
841 }
842
843 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
864 pub struct Duration {
865 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
866 pub duration: ::std::option::Option<f64>,
867 }
868
869 impl ::std::convert::From<&Duration> for Duration {
870 fn from(value: &Duration) -> Self {
871 value.clone()
872 }
873 }
874
875 impl ::std::default::Default for Duration {
876 fn default() -> Self {
877 Self {
878 duration: Default::default(),
879 }
880 }
881 }
882
883 impl Duration {
884 pub fn builder() -> builder::Duration {
885 Default::default()
886 }
887 }
888
889 #[derive(
923 :: serde :: Deserialize,
924 :: serde :: Serialize,
925 Clone,
926 Copy,
927 Debug,
928 Eq,
929 Hash,
930 Ord,
931 PartialEq,
932 PartialOrd,
933 )]
934 pub enum ElevationCosts {
935 #[serde(rename = "NONE")]
936 None,
937 #[serde(rename = "LOW")]
938 Low,
939 #[serde(rename = "HIGH")]
940 High,
941 }
942
943 impl ::std::convert::From<&Self> for ElevationCosts {
944 fn from(value: &ElevationCosts) -> Self {
945 value.clone()
946 }
947 }
948
949 impl ::std::fmt::Display for ElevationCosts {
950 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
951 match *self {
952 Self::None => f.write_str("NONE"),
953 Self::Low => f.write_str("LOW"),
954 Self::High => f.write_str("HIGH"),
955 }
956 }
957 }
958
959 impl ::std::str::FromStr for ElevationCosts {
960 type Err = self::error::ConversionError;
961 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
962 match value {
963 "NONE" => Ok(Self::None),
964 "LOW" => Ok(Self::Low),
965 "HIGH" => Ok(Self::High),
966 _ => Err("invalid value".into()),
967 }
968 }
969 }
970
971 impl ::std::convert::TryFrom<&str> for ElevationCosts {
972 type Error = self::error::ConversionError;
973 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
974 value.parse()
975 }
976 }
977
978 impl ::std::convert::TryFrom<&::std::string::String> for ElevationCosts {
979 type Error = self::error::ConversionError;
980 fn try_from(
981 value: &::std::string::String,
982 ) -> ::std::result::Result<Self, self::error::ConversionError> {
983 value.parse()
984 }
985 }
986
987 impl ::std::convert::TryFrom<::std::string::String> for ElevationCosts {
988 type Error = self::error::ConversionError;
989 fn try_from(
990 value: ::std::string::String,
991 ) -> ::std::result::Result<Self, self::error::ConversionError> {
992 value.parse()
993 }
994 }
995
996 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1030 pub struct EncodedPolyline {
1031 pub length: u64,
1033 pub points: ::std::string::String,
1036 pub precision: i64,
1040 }
1041
1042 impl ::std::convert::From<&EncodedPolyline> for EncodedPolyline {
1043 fn from(value: &EncodedPolyline) -> Self {
1044 value.clone()
1045 }
1046 }
1047
1048 impl EncodedPolyline {
1049 pub fn builder() -> builder::EncodedPolyline {
1050 Default::default()
1051 }
1052 }
1053
1054 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1078 pub struct FareMedia {
1079 #[serde(
1081 rename = "fareMediaName",
1082 default,
1083 skip_serializing_if = "::std::option::Option::is_none"
1084 )]
1085 pub fare_media_name: ::std::option::Option<::std::string::String>,
1086 #[serde(rename = "fareMediaType")]
1087 pub fare_media_type: FareMediaType,
1088 }
1089
1090 impl ::std::convert::From<&FareMedia> for FareMedia {
1091 fn from(value: &FareMedia) -> Self {
1092 value.clone()
1093 }
1094 }
1095
1096 impl FareMedia {
1097 pub fn builder() -> builder::FareMedia {
1098 Default::default()
1099 }
1100 }
1101
1102 #[derive(
1129 :: serde :: Deserialize,
1130 :: serde :: Serialize,
1131 Clone,
1132 Copy,
1133 Debug,
1134 Eq,
1135 Hash,
1136 Ord,
1137 PartialEq,
1138 PartialOrd,
1139 )]
1140 pub enum FareMediaType {
1141 #[serde(rename = "NONE")]
1142 None,
1143 #[serde(rename = "PAPER_TICKET")]
1144 PaperTicket,
1145 #[serde(rename = "TRANSIT_CARD")]
1146 TransitCard,
1147 #[serde(rename = "CONTACTLESS_EMV")]
1148 ContactlessEmv,
1149 #[serde(rename = "MOBILE_APP")]
1150 MobileApp,
1151 }
1152
1153 impl ::std::convert::From<&Self> for FareMediaType {
1154 fn from(value: &FareMediaType) -> Self {
1155 value.clone()
1156 }
1157 }
1158
1159 impl ::std::fmt::Display for FareMediaType {
1160 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1161 match *self {
1162 Self::None => f.write_str("NONE"),
1163 Self::PaperTicket => f.write_str("PAPER_TICKET"),
1164 Self::TransitCard => f.write_str("TRANSIT_CARD"),
1165 Self::ContactlessEmv => f.write_str("CONTACTLESS_EMV"),
1166 Self::MobileApp => f.write_str("MOBILE_APP"),
1167 }
1168 }
1169 }
1170
1171 impl ::std::str::FromStr for FareMediaType {
1172 type Err = self::error::ConversionError;
1173 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1174 match value {
1175 "NONE" => Ok(Self::None),
1176 "PAPER_TICKET" => Ok(Self::PaperTicket),
1177 "TRANSIT_CARD" => Ok(Self::TransitCard),
1178 "CONTACTLESS_EMV" => Ok(Self::ContactlessEmv),
1179 "MOBILE_APP" => Ok(Self::MobileApp),
1180 _ => Err("invalid value".into()),
1181 }
1182 }
1183 }
1184
1185 impl ::std::convert::TryFrom<&str> for FareMediaType {
1186 type Error = self::error::ConversionError;
1187 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1188 value.parse()
1189 }
1190 }
1191
1192 impl ::std::convert::TryFrom<&::std::string::String> for FareMediaType {
1193 type Error = self::error::ConversionError;
1194 fn try_from(
1195 value: &::std::string::String,
1196 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1197 value.parse()
1198 }
1199 }
1200
1201 impl ::std::convert::TryFrom<::std::string::String> for FareMediaType {
1202 type Error = self::error::ConversionError;
1203 fn try_from(
1204 value: ::std::string::String,
1205 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1206 value.parse()
1207 }
1208 }
1209
1210 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1250 pub struct FareProduct {
1251 pub amount: f64,
1252 pub currency: ::std::string::String,
1255 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1256 pub media: ::std::option::Option<FareMedia>,
1257 pub name: ::std::string::String,
1259 #[serde(
1260 rename = "riderCategory",
1261 default,
1262 skip_serializing_if = "::std::option::Option::is_none"
1263 )]
1264 pub rider_category: ::std::option::Option<RiderCategory>,
1265 }
1266
1267 impl ::std::convert::From<&FareProduct> for FareProduct {
1268 fn from(value: &FareProduct) -> Self {
1269 value.clone()
1270 }
1271 }
1272
1273 impl FareProduct {
1274 pub fn builder() -> builder::FareProduct {
1275 Default::default()
1276 }
1277 }
1278
1279 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1356 pub struct FareTransfer {
1357 #[serde(rename = "effectiveFareLegProducts")]
1367 pub effective_fare_leg_products:
1368 ::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<FareProduct>>>,
1369 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1370 pub rule: ::std::option::Option<FareTransferRule>,
1371 #[serde(
1372 rename = "transferProducts",
1373 default,
1374 skip_serializing_if = "::std::vec::Vec::is_empty"
1375 )]
1376 pub transfer_products: ::std::vec::Vec<FareProduct>,
1377 }
1378
1379 impl ::std::convert::From<&FareTransfer> for FareTransfer {
1380 fn from(value: &FareTransfer) -> Self {
1381 value.clone()
1382 }
1383 }
1384
1385 impl FareTransfer {
1386 pub fn builder() -> builder::FareTransfer {
1387 Default::default()
1388 }
1389 }
1390
1391 #[derive(
1407 :: serde :: Deserialize,
1408 :: serde :: Serialize,
1409 Clone,
1410 Copy,
1411 Debug,
1412 Eq,
1413 Hash,
1414 Ord,
1415 PartialEq,
1416 PartialOrd,
1417 )]
1418 pub enum FareTransferRule {
1419 #[serde(rename = "A_AB")]
1420 AAb,
1421 #[serde(rename = "A_AB_B")]
1422 AAbB,
1423 #[serde(rename = "AB")]
1424 Ab,
1425 }
1426
1427 impl ::std::convert::From<&Self> for FareTransferRule {
1428 fn from(value: &FareTransferRule) -> Self {
1429 value.clone()
1430 }
1431 }
1432
1433 impl ::std::fmt::Display for FareTransferRule {
1434 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1435 match *self {
1436 Self::AAb => f.write_str("A_AB"),
1437 Self::AAbB => f.write_str("A_AB_B"),
1438 Self::Ab => f.write_str("AB"),
1439 }
1440 }
1441 }
1442
1443 impl ::std::str::FromStr for FareTransferRule {
1444 type Err = self::error::ConversionError;
1445 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1446 match value {
1447 "A_AB" => Ok(Self::AAb),
1448 "A_AB_B" => Ok(Self::AAbB),
1449 "AB" => Ok(Self::Ab),
1450 _ => Err("invalid value".into()),
1451 }
1452 }
1453 }
1454
1455 impl ::std::convert::TryFrom<&str> for FareTransferRule {
1456 type Error = self::error::ConversionError;
1457 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1458 value.parse()
1459 }
1460 }
1461
1462 impl ::std::convert::TryFrom<&::std::string::String> for FareTransferRule {
1463 type Error = self::error::ConversionError;
1464 fn try_from(
1465 value: &::std::string::String,
1466 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1467 value.parse()
1468 }
1469 }
1470
1471 impl ::std::convert::TryFrom<::std::string::String> for FareTransferRule {
1472 type Error = self::error::ConversionError;
1473 fn try_from(
1474 value: ::std::string::String,
1475 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1476 value.parse()
1477 }
1478 }
1479
1480 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1510 pub struct InitialResponse {
1511 pub lat: f64,
1512 pub lon: f64,
1513 pub zoom: f64,
1514 }
1515
1516 impl ::std::convert::From<&InitialResponse> for InitialResponse {
1517 fn from(value: &InitialResponse) -> Self {
1518 value.clone()
1519 }
1520 }
1521
1522 impl InitialResponse {
1523 pub fn builder() -> builder::InitialResponse {
1524 Default::default()
1525 }
1526 }
1527
1528 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1580 pub struct Itinerary {
1581 pub duration: i64,
1583 #[serde(rename = "endTime")]
1585 pub end_time: ::chrono::DateTime<::chrono::offset::Utc>,
1586 #[serde(
1588 rename = "fareTransfers",
1589 default,
1590 skip_serializing_if = "::std::vec::Vec::is_empty"
1591 )]
1592 pub fare_transfers: ::std::vec::Vec<FareTransfer>,
1593 pub legs: ::std::vec::Vec<Leg>,
1595 #[serde(rename = "startTime")]
1597 pub start_time: ::chrono::DateTime<::chrono::offset::Utc>,
1598 pub transfers: i64,
1600 }
1601
1602 impl ::std::convert::From<&Itinerary> for Itinerary {
1603 fn from(value: &Itinerary) -> Self {
1604 value.clone()
1605 }
1606 }
1607
1608 impl Itinerary {
1609 pub fn builder() -> builder::Itinerary {
1610 Default::default()
1611 }
1612 }
1613
1614 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
1801 pub struct Leg {
1802 #[serde(
1803 rename = "agencyId",
1804 default,
1805 skip_serializing_if = "::std::option::Option::is_none"
1806 )]
1807 pub agency_id: ::std::option::Option<::std::string::String>,
1808 #[serde(
1809 rename = "agencyName",
1810 default,
1811 skip_serializing_if = "::std::option::Option::is_none"
1812 )]
1813 pub agency_name: ::std::option::Option<::std::string::String>,
1814 #[serde(
1815 rename = "agencyUrl",
1816 default,
1817 skip_serializing_if = "::std::option::Option::is_none"
1818 )]
1819 pub agency_url: ::std::option::Option<::std::string::String>,
1820 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1822 pub alerts: ::std::vec::Vec<Alert>,
1823 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1825 pub cancelled: ::std::option::Option<bool>,
1826 #[serde(
1827 rename = "displayName",
1828 default,
1829 skip_serializing_if = "::std::option::Option::is_none"
1830 )]
1831 pub display_name: ::std::option::Option<::std::string::String>,
1832 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1833 pub distance: ::std::option::Option<f64>,
1834 pub duration: i64,
1848 #[serde(
1853 rename = "effectiveFareLegIndex",
1854 default,
1855 skip_serializing_if = "::std::option::Option::is_none"
1856 )]
1857 pub effective_fare_leg_index: ::std::option::Option<i64>,
1858 #[serde(rename = "endTime")]
1860 pub end_time: ::chrono::DateTime<::chrono::offset::Utc>,
1861 #[serde(
1864 rename = "fareTransferIndex",
1865 default,
1866 skip_serializing_if = "::std::option::Option::is_none"
1867 )]
1868 pub fare_transfer_index: ::std::option::Option<i64>,
1869 pub from: Place,
1870 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1873 pub headsign: ::std::option::Option<::std::string::String>,
1874 #[serde(
1877 rename = "interlineWithPreviousLeg",
1878 default,
1879 skip_serializing_if = "::std::option::Option::is_none"
1880 )]
1881 pub interline_with_previous_leg: ::std::option::Option<bool>,
1882 #[serde(
1886 rename = "intermediateStops",
1887 default,
1888 skip_serializing_if = "::std::vec::Vec::is_empty"
1889 )]
1890 pub intermediate_stops: ::std::vec::Vec<Place>,
1891 #[serde(rename = "legGeometry")]
1892 pub leg_geometry: EncodedPolyline,
1893 #[serde(
1898 rename = "loopedCalendarSince",
1899 default,
1900 skip_serializing_if = "::std::option::Option::is_none"
1901 )]
1902 pub looped_calendar_since: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
1903 pub mode: Mode,
1904 #[serde(rename = "realTime")]
1906 pub real_time: bool,
1907 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1908 pub rental: ::std::option::Option<Rental>,
1909 #[serde(
1910 rename = "routeColor",
1911 default,
1912 skip_serializing_if = "::std::option::Option::is_none"
1913 )]
1914 pub route_color: ::std::option::Option<::std::string::String>,
1915 #[serde(
1916 rename = "routeLongName",
1917 default,
1918 skip_serializing_if = "::std::option::Option::is_none"
1919 )]
1920 pub route_long_name: ::std::option::Option<::std::string::String>,
1921 #[serde(
1922 rename = "routeShortName",
1923 default,
1924 skip_serializing_if = "::std::option::Option::is_none"
1925 )]
1926 pub route_short_name: ::std::option::Option<::std::string::String>,
1927 #[serde(
1928 rename = "routeTextColor",
1929 default,
1930 skip_serializing_if = "::std::option::Option::is_none"
1931 )]
1932 pub route_text_color: ::std::option::Option<::std::string::String>,
1933 #[serde(
1934 rename = "routeType",
1935 default,
1936 skip_serializing_if = "::std::option::Option::is_none"
1937 )]
1938 pub route_type: ::std::option::Option<i64>,
1939 pub scheduled: bool,
1943 #[serde(rename = "scheduledEndTime")]
1945 pub scheduled_end_time: ::chrono::DateTime<::chrono::offset::Utc>,
1946 #[serde(rename = "scheduledStartTime")]
1948 pub scheduled_start_time: ::chrono::DateTime<::chrono::offset::Utc>,
1949 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1951 pub source: ::std::option::Option<::std::string::String>,
1952 #[serde(rename = "startTime")]
1954 pub start_time: ::chrono::DateTime<::chrono::offset::Utc>,
1955 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1958 pub steps: ::std::vec::Vec<StepInstruction>,
1959 pub to: Place,
1960 #[serde(
1961 rename = "tripId",
1962 default,
1963 skip_serializing_if = "::std::option::Option::is_none"
1964 )]
1965 pub trip_id: ::std::option::Option<::std::string::String>,
1966 #[serde(
1967 rename = "tripShortName",
1968 default,
1969 skip_serializing_if = "::std::option::Option::is_none"
1970 )]
1971 pub trip_short_name: ::std::option::Option<::std::string::String>,
1972 #[serde(
1973 rename = "tripTo",
1974 default,
1975 skip_serializing_if = "::std::option::Option::is_none"
1976 )]
1977 pub trip_to: ::std::option::Option<Place>,
1978 }
1979
1980 impl ::std::convert::From<&Leg> for Leg {
1981 fn from(value: &Leg) -> Self {
1982 value.clone()
1983 }
1984 }
1985
1986 impl Leg {
1987 pub fn builder() -> builder::Leg {
1988 Default::default()
1989 }
1990 }
1991
1992 #[derive(
2009 :: serde :: Deserialize,
2010 :: serde :: Serialize,
2011 Clone,
2012 Copy,
2013 Debug,
2014 Eq,
2015 Hash,
2016 Ord,
2017 PartialEq,
2018 PartialOrd,
2019 )]
2020 pub enum LocationType {
2021 #[serde(rename = "ADDRESS")]
2022 Address,
2023 #[serde(rename = "PLACE")]
2024 Place,
2025 #[serde(rename = "STOP")]
2026 Stop,
2027 }
2028
2029 impl ::std::convert::From<&Self> for LocationType {
2030 fn from(value: &LocationType) -> Self {
2031 value.clone()
2032 }
2033 }
2034
2035 impl ::std::fmt::Display for LocationType {
2036 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2037 match *self {
2038 Self::Address => f.write_str("ADDRESS"),
2039 Self::Place => f.write_str("PLACE"),
2040 Self::Stop => f.write_str("STOP"),
2041 }
2042 }
2043 }
2044
2045 impl ::std::str::FromStr for LocationType {
2046 type Err = self::error::ConversionError;
2047 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2048 match value {
2049 "ADDRESS" => Ok(Self::Address),
2050 "PLACE" => Ok(Self::Place),
2051 "STOP" => Ok(Self::Stop),
2052 _ => Err("invalid value".into()),
2053 }
2054 }
2055 }
2056
2057 impl ::std::convert::TryFrom<&str> for LocationType {
2058 type Error = self::error::ConversionError;
2059 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2060 value.parse()
2061 }
2062 }
2063
2064 impl ::std::convert::TryFrom<&::std::string::String> for LocationType {
2065 type Error = self::error::ConversionError;
2066 fn try_from(
2067 value: &::std::string::String,
2068 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2069 value.parse()
2070 }
2071 }
2072
2073 impl ::std::convert::TryFrom<::std::string::String> for LocationType {
2074 type Error = self::error::ConversionError;
2075 fn try_from(
2076 value: ::std::string::String,
2077 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2078 value.parse()
2079 }
2080 }
2081
2082 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2166 pub struct Match {
2167 pub areas: ::std::vec::Vec<Area>,
2169 #[serde(
2171 rename = "houseNumber",
2172 default,
2173 skip_serializing_if = "::std::option::Option::is_none"
2174 )]
2175 pub house_number: ::std::option::Option<::std::string::String>,
2176 pub id: ::std::string::String,
2178 pub lat: f64,
2179 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2180 pub level: ::std::option::Option<f64>,
2181 pub lon: f64,
2182 pub name: ::std::string::String,
2184 pub score: f64,
2185 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2187 pub street: ::std::option::Option<::std::string::String>,
2188 pub tokens: ::std::vec::Vec<Token>,
2190 #[serde(rename = "type")]
2191 pub type_: LocationType,
2192 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2194 pub tz: ::std::option::Option<::std::string::String>,
2195 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2197 pub zip: ::std::option::Option<::std::string::String>,
2198 }
2199
2200 impl ::std::convert::From<&Match> for Match {
2201 fn from(value: &Match) -> Self {
2202 value.clone()
2203 }
2204 }
2205
2206 impl Match {
2207 pub fn builder() -> builder::Match {
2208 Default::default()
2209 }
2210 }
2211
2212 #[derive(
2318 :: serde :: Deserialize,
2319 :: serde :: Serialize,
2320 Clone,
2321 Copy,
2322 Debug,
2323 Eq,
2324 Hash,
2325 Ord,
2326 PartialEq,
2327 PartialOrd,
2328 )]
2329 pub enum Mode {
2330 #[serde(rename = "WALK")]
2331 Walk,
2332 #[serde(rename = "BIKE")]
2333 Bike,
2334 #[serde(rename = "RENTAL")]
2335 Rental,
2336 #[serde(rename = "CAR")]
2337 Car,
2338 #[serde(rename = "CAR_PARKING")]
2339 CarParking,
2340 #[serde(rename = "CAR_DROPOFF")]
2341 CarDropoff,
2342 #[serde(rename = "ODM")]
2343 Odm,
2344 #[serde(rename = "FLEX")]
2345 Flex,
2346 #[serde(rename = "TRANSIT")]
2347 Transit,
2348 #[serde(rename = "TRAM")]
2349 Tram,
2350 #[serde(rename = "SUBWAY")]
2351 Subway,
2352 #[serde(rename = "FERRY")]
2353 Ferry,
2354 #[serde(rename = "AIRPLANE")]
2355 Airplane,
2356 #[serde(rename = "METRO")]
2357 Metro,
2358 #[serde(rename = "BUS")]
2359 Bus,
2360 #[serde(rename = "COACH")]
2361 Coach,
2362 #[serde(rename = "RAIL")]
2363 Rail,
2364 #[serde(rename = "HIGHSPEED_RAIL")]
2365 HighspeedRail,
2366 #[serde(rename = "LONG_DISTANCE")]
2367 LongDistance,
2368 #[serde(rename = "NIGHT_RAIL")]
2369 NightRail,
2370 #[serde(rename = "REGIONAL_FAST_RAIL")]
2371 RegionalFastRail,
2372 #[serde(rename = "REGIONAL_RAIL")]
2373 RegionalRail,
2374 #[serde(rename = "CABLE_CAR")]
2375 CableCar,
2376 #[serde(rename = "FUNICULAR")]
2377 Funicular,
2378 #[serde(rename = "AREAL_LIFT")]
2379 ArealLift,
2380 #[serde(rename = "OTHER")]
2381 Other,
2382 }
2383
2384 impl ::std::convert::From<&Self> for Mode {
2385 fn from(value: &Mode) -> Self {
2386 value.clone()
2387 }
2388 }
2389
2390 impl ::std::fmt::Display for Mode {
2391 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2392 match *self {
2393 Self::Walk => f.write_str("WALK"),
2394 Self::Bike => f.write_str("BIKE"),
2395 Self::Rental => f.write_str("RENTAL"),
2396 Self::Car => f.write_str("CAR"),
2397 Self::CarParking => f.write_str("CAR_PARKING"),
2398 Self::CarDropoff => f.write_str("CAR_DROPOFF"),
2399 Self::Odm => f.write_str("ODM"),
2400 Self::Flex => f.write_str("FLEX"),
2401 Self::Transit => f.write_str("TRANSIT"),
2402 Self::Tram => f.write_str("TRAM"),
2403 Self::Subway => f.write_str("SUBWAY"),
2404 Self::Ferry => f.write_str("FERRY"),
2405 Self::Airplane => f.write_str("AIRPLANE"),
2406 Self::Metro => f.write_str("METRO"),
2407 Self::Bus => f.write_str("BUS"),
2408 Self::Coach => f.write_str("COACH"),
2409 Self::Rail => f.write_str("RAIL"),
2410 Self::HighspeedRail => f.write_str("HIGHSPEED_RAIL"),
2411 Self::LongDistance => f.write_str("LONG_DISTANCE"),
2412 Self::NightRail => f.write_str("NIGHT_RAIL"),
2413 Self::RegionalFastRail => f.write_str("REGIONAL_FAST_RAIL"),
2414 Self::RegionalRail => f.write_str("REGIONAL_RAIL"),
2415 Self::CableCar => f.write_str("CABLE_CAR"),
2416 Self::Funicular => f.write_str("FUNICULAR"),
2417 Self::ArealLift => f.write_str("AREAL_LIFT"),
2418 Self::Other => f.write_str("OTHER"),
2419 }
2420 }
2421 }
2422
2423 impl ::std::str::FromStr for Mode {
2424 type Err = self::error::ConversionError;
2425 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2426 match value {
2427 "WALK" => Ok(Self::Walk),
2428 "BIKE" => Ok(Self::Bike),
2429 "RENTAL" => Ok(Self::Rental),
2430 "CAR" => Ok(Self::Car),
2431 "CAR_PARKING" => Ok(Self::CarParking),
2432 "CAR_DROPOFF" => Ok(Self::CarDropoff),
2433 "ODM" => Ok(Self::Odm),
2434 "FLEX" => Ok(Self::Flex),
2435 "TRANSIT" => Ok(Self::Transit),
2436 "TRAM" => Ok(Self::Tram),
2437 "SUBWAY" => Ok(Self::Subway),
2438 "FERRY" => Ok(Self::Ferry),
2439 "AIRPLANE" => Ok(Self::Airplane),
2440 "METRO" => Ok(Self::Metro),
2441 "BUS" => Ok(Self::Bus),
2442 "COACH" => Ok(Self::Coach),
2443 "RAIL" => Ok(Self::Rail),
2444 "HIGHSPEED_RAIL" => Ok(Self::HighspeedRail),
2445 "LONG_DISTANCE" => Ok(Self::LongDistance),
2446 "NIGHT_RAIL" => Ok(Self::NightRail),
2447 "REGIONAL_FAST_RAIL" => Ok(Self::RegionalFastRail),
2448 "REGIONAL_RAIL" => Ok(Self::RegionalRail),
2449 "CABLE_CAR" => Ok(Self::CableCar),
2450 "FUNICULAR" => Ok(Self::Funicular),
2451 "AREAL_LIFT" => Ok(Self::ArealLift),
2452 "OTHER" => Ok(Self::Other),
2453 _ => Err("invalid value".into()),
2454 }
2455 }
2456 }
2457
2458 impl ::std::convert::TryFrom<&str> for Mode {
2459 type Error = self::error::ConversionError;
2460 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2461 value.parse()
2462 }
2463 }
2464
2465 impl ::std::convert::TryFrom<&::std::string::String> for Mode {
2466 type Error = self::error::ConversionError;
2467 fn try_from(
2468 value: &::std::string::String,
2469 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2470 value.parse()
2471 }
2472 }
2473
2474 impl ::std::convert::TryFrom<::std::string::String> for Mode {
2475 type Error = self::error::ConversionError;
2476 fn try_from(
2477 value: ::std::string::String,
2478 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2479 value.parse()
2480 }
2481 }
2482
2483 #[derive(
2499 :: serde :: Deserialize,
2500 :: serde :: Serialize,
2501 Clone,
2502 Copy,
2503 Debug,
2504 Eq,
2505 Hash,
2506 Ord,
2507 PartialEq,
2508 PartialOrd,
2509 )]
2510 pub enum PedestrianProfile {
2511 #[serde(rename = "FOOT")]
2512 Foot,
2513 #[serde(rename = "WHEELCHAIR")]
2514 Wheelchair,
2515 }
2516
2517 impl ::std::convert::From<&Self> for PedestrianProfile {
2518 fn from(value: &PedestrianProfile) -> Self {
2519 value.clone()
2520 }
2521 }
2522
2523 impl ::std::fmt::Display for PedestrianProfile {
2524 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2525 match *self {
2526 Self::Foot => f.write_str("FOOT"),
2527 Self::Wheelchair => f.write_str("WHEELCHAIR"),
2528 }
2529 }
2530 }
2531
2532 impl ::std::str::FromStr for PedestrianProfile {
2533 type Err = self::error::ConversionError;
2534 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2535 match value {
2536 "FOOT" => Ok(Self::Foot),
2537 "WHEELCHAIR" => Ok(Self::Wheelchair),
2538 _ => Err("invalid value".into()),
2539 }
2540 }
2541 }
2542
2543 impl ::std::convert::TryFrom<&str> for PedestrianProfile {
2544 type Error = self::error::ConversionError;
2545 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2546 value.parse()
2547 }
2548 }
2549
2550 impl ::std::convert::TryFrom<&::std::string::String> for PedestrianProfile {
2551 type Error = self::error::ConversionError;
2552 fn try_from(
2553 value: &::std::string::String,
2554 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2555 value.parse()
2556 }
2557 }
2558
2559 impl ::std::convert::TryFrom<::std::string::String> for PedestrianProfile {
2560 type Error = self::error::ConversionError;
2561 fn try_from(
2562 value: ::std::string::String,
2563 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2564 value.parse()
2565 }
2566 }
2567
2568 #[derive(
2586 :: serde :: Deserialize,
2587 :: serde :: Serialize,
2588 Clone,
2589 Copy,
2590 Debug,
2591 Eq,
2592 Hash,
2593 Ord,
2594 PartialEq,
2595 PartialOrd,
2596 )]
2597 pub enum PickupDropoffType {
2598 #[serde(rename = "NORMAL")]
2599 Normal,
2600 #[serde(rename = "NOT_ALLOWED")]
2601 NotAllowed,
2602 }
2603
2604 impl ::std::convert::From<&Self> for PickupDropoffType {
2605 fn from(value: &PickupDropoffType) -> Self {
2606 value.clone()
2607 }
2608 }
2609
2610 impl ::std::fmt::Display for PickupDropoffType {
2611 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2612 match *self {
2613 Self::Normal => f.write_str("NORMAL"),
2614 Self::NotAllowed => f.write_str("NOT_ALLOWED"),
2615 }
2616 }
2617 }
2618
2619 impl ::std::str::FromStr for PickupDropoffType {
2620 type Err = self::error::ConversionError;
2621 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2622 match value {
2623 "NORMAL" => Ok(Self::Normal),
2624 "NOT_ALLOWED" => Ok(Self::NotAllowed),
2625 _ => Err("invalid value".into()),
2626 }
2627 }
2628 }
2629
2630 impl ::std::convert::TryFrom<&str> for PickupDropoffType {
2631 type Error = self::error::ConversionError;
2632 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2633 value.parse()
2634 }
2635 }
2636
2637 impl ::std::convert::TryFrom<&::std::string::String> for PickupDropoffType {
2638 type Error = self::error::ConversionError;
2639 fn try_from(
2640 value: &::std::string::String,
2641 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2642 value.parse()
2643 }
2644 }
2645
2646 impl ::std::convert::TryFrom<::std::string::String> for PickupDropoffType {
2647 type Error = self::error::ConversionError;
2648 fn try_from(
2649 value: ::std::string::String,
2650 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2651 value.parse()
2652 }
2653 }
2654
2655 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
2777 pub struct Place {
2778 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2780 pub alerts: ::std::vec::Vec<Alert>,
2781 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2783 pub arrival: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2784 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2786 pub cancelled: ::std::option::Option<bool>,
2787 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2789 pub departure: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2790 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2792 pub description: ::std::option::Option<::std::string::String>,
2793 #[serde(
2794 rename = "dropoffType",
2795 default,
2796 skip_serializing_if = "::std::option::Option::is_none"
2797 )]
2798 pub dropoff_type: ::std::option::Option<PickupDropoffType>,
2799 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2801 pub flex: ::std::option::Option<::std::string::String>,
2802 #[serde(
2804 rename = "flexEndPickupDropOffWindow",
2805 default,
2806 skip_serializing_if = "::std::option::Option::is_none"
2807 )]
2808 pub flex_end_pickup_drop_off_window:
2809 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2810 #[serde(
2813 rename = "flexId",
2814 default,
2815 skip_serializing_if = "::std::option::Option::is_none"
2816 )]
2817 pub flex_id: ::std::option::Option<::std::string::String>,
2818 #[serde(
2820 rename = "flexStartPickupDropOffWindow",
2821 default,
2822 skip_serializing_if = "::std::option::Option::is_none"
2823 )]
2824 pub flex_start_pickup_drop_off_window:
2825 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2826 pub lat: f64,
2827 pub level: f64,
2828 pub lon: f64,
2829 pub name: ::std::string::String,
2831 #[serde(
2832 rename = "pickupType",
2833 default,
2834 skip_serializing_if = "::std::option::Option::is_none"
2835 )]
2836 pub pickup_type: ::std::option::Option<PickupDropoffType>,
2837 #[serde(
2839 rename = "scheduledArrival",
2840 default,
2841 skip_serializing_if = "::std::option::Option::is_none"
2842 )]
2843 pub scheduled_arrival: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2844 #[serde(
2846 rename = "scheduledDeparture",
2847 default,
2848 skip_serializing_if = "::std::option::Option::is_none"
2849 )]
2850 pub scheduled_departure: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
2851 #[serde(
2853 rename = "scheduledTrack",
2854 default,
2855 skip_serializing_if = "::std::option::Option::is_none"
2856 )]
2857 pub scheduled_track: ::std::option::Option<::std::string::String>,
2858 #[serde(
2861 rename = "stopId",
2862 default,
2863 skip_serializing_if = "::std::option::Option::is_none"
2864 )]
2865 pub stop_id: ::std::option::Option<::std::string::String>,
2866 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2870 pub track: ::std::option::Option<::std::string::String>,
2871 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2873 pub tz: ::std::option::Option<::std::string::String>,
2874 #[serde(
2875 rename = "vertexType",
2876 default,
2877 skip_serializing_if = "::std::option::Option::is_none"
2878 )]
2879 pub vertex_type: ::std::option::Option<VertexType>,
2880 }
2881
2882 impl ::std::convert::From<&Place> for Place {
2883 fn from(value: &Place) -> Self {
2884 value.clone()
2885 }
2886 }
2887
2888 impl Place {
2889 pub fn builder() -> builder::Place {
2890 Default::default()
2891 }
2892 }
2893
2894 #[derive(
2910 :: serde :: Deserialize,
2911 :: serde :: Serialize,
2912 Clone,
2913 Copy,
2914 Debug,
2915 Eq,
2916 Hash,
2917 Ord,
2918 PartialEq,
2919 PartialOrd,
2920 )]
2921 pub enum PlanAlgorithm {
2922 #[serde(rename = "RAPTOR")]
2923 Raptor,
2924 #[serde(rename = "TB")]
2925 Tb,
2926 }
2927
2928 impl ::std::convert::From<&Self> for PlanAlgorithm {
2929 fn from(value: &PlanAlgorithm) -> Self {
2930 value.clone()
2931 }
2932 }
2933
2934 impl ::std::fmt::Display for PlanAlgorithm {
2935 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2936 match *self {
2937 Self::Raptor => f.write_str("RAPTOR"),
2938 Self::Tb => f.write_str("TB"),
2939 }
2940 }
2941 }
2942
2943 impl ::std::str::FromStr for PlanAlgorithm {
2944 type Err = self::error::ConversionError;
2945 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2946 match value {
2947 "RAPTOR" => Ok(Self::Raptor),
2948 "TB" => Ok(Self::Tb),
2949 _ => Err("invalid value".into()),
2950 }
2951 }
2952 }
2953
2954 impl ::std::convert::TryFrom<&str> for PlanAlgorithm {
2955 type Error = self::error::ConversionError;
2956 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2957 value.parse()
2958 }
2959 }
2960
2961 impl ::std::convert::TryFrom<&::std::string::String> for PlanAlgorithm {
2962 type Error = self::error::ConversionError;
2963 fn try_from(
2964 value: &::std::string::String,
2965 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2966 value.parse()
2967 }
2968 }
2969
2970 impl ::std::convert::TryFrom<::std::string::String> for PlanAlgorithm {
2971 type Error = self::error::ConversionError;
2972 fn try_from(
2973 value: ::std::string::String,
2974 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2975 value.parse()
2976 }
2977 }
2978
2979 impl ::std::default::Default for PlanAlgorithm {
2980 fn default() -> Self {
2981 PlanAlgorithm::Raptor
2982 }
2983 }
2984
2985 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3062 pub struct PlanResponse {
3063 #[serde(rename = "debugOutput")]
3065 pub debug_output: ::std::collections::HashMap<::std::string::String, i64>,
3066 pub direct: ::std::vec::Vec<Itinerary>,
3072 pub from: Place,
3073 pub itineraries: ::std::vec::Vec<Itinerary>,
3075 #[serde(rename = "nextPageCursor")]
3080 pub next_page_cursor: ::std::string::String,
3081 #[serde(rename = "previousPageCursor")]
3088 pub previous_page_cursor: ::std::string::String,
3089 #[serde(rename = "requestParameters")]
3091 pub request_parameters:
3092 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
3093 pub to: Place,
3094 }
3095
3096 impl ::std::convert::From<&PlanResponse> for PlanResponse {
3097 fn from(value: &PlanResponse) -> Self {
3098 value.clone()
3099 }
3100 }
3101
3102 impl PlanResponse {
3103 pub fn builder() -> builder::PlanResponse {
3104 Default::default()
3105 }
3106 }
3107
3108 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3133 pub struct Reachable {
3134 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3136 pub all: ::std::vec::Vec<ReachablePlace>,
3137 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3138 pub one: ::std::option::Option<Place>,
3139 }
3140
3141 impl ::std::convert::From<&Reachable> for Reachable {
3142 fn from(value: &Reachable) -> Self {
3143 value.clone()
3144 }
3145 }
3146
3147 impl ::std::default::Default for Reachable {
3148 fn default() -> Self {
3149 Self {
3150 all: Default::default(),
3151 one: Default::default(),
3152 }
3153 }
3154 }
3155
3156 impl Reachable {
3157 pub fn builder() -> builder::Reachable {
3158 Default::default()
3159 }
3160 }
3161
3162 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3191 pub struct ReachablePlace {
3192 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3194 pub duration: ::std::option::Option<i64>,
3195 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3205 pub k: ::std::option::Option<i64>,
3206 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3207 pub place: ::std::option::Option<Place>,
3208 }
3209
3210 impl ::std::convert::From<&ReachablePlace> for ReachablePlace {
3211 fn from(value: &ReachablePlace) -> Self {
3212 value.clone()
3213 }
3214 }
3215
3216 impl ::std::default::Default for ReachablePlace {
3217 fn default() -> Self {
3218 Self {
3219 duration: Default::default(),
3220 k: Default::default(),
3221 place: Default::default(),
3222 }
3223 }
3224 }
3225
3226 impl ReachablePlace {
3227 pub fn builder() -> builder::ReachablePlace {
3228 Default::default()
3229 }
3230 }
3231
3232 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3299 pub struct Rental {
3300 #[serde(
3301 rename = "formFactor",
3302 default,
3303 skip_serializing_if = "::std::option::Option::is_none"
3304 )]
3305 pub form_factor: ::std::option::Option<RentalFormFactor>,
3306 #[serde(
3309 rename = "fromStationName",
3310 default,
3311 skip_serializing_if = "::std::option::Option::is_none"
3312 )]
3313 pub from_station_name: ::std::option::Option<::std::string::String>,
3314 #[serde(
3315 rename = "propulsionType",
3316 default,
3317 skip_serializing_if = "::std::option::Option::is_none"
3318 )]
3319 pub propulsion_type: ::std::option::Option<RentalPropulsionType>,
3320 #[serde(
3323 rename = "rentalUriAndroid",
3324 default,
3325 skip_serializing_if = "::std::option::Option::is_none"
3326 )]
3327 pub rental_uri_android: ::std::option::Option<::std::string::String>,
3328 #[serde(
3330 rename = "rentalUriIOS",
3331 default,
3332 skip_serializing_if = "::std::option::Option::is_none"
3333 )]
3334 pub rental_uri_ios: ::std::option::Option<::std::string::String>,
3335 #[serde(
3337 rename = "rentalUriWeb",
3338 default,
3339 skip_serializing_if = "::std::option::Option::is_none"
3340 )]
3341 pub rental_uri_web: ::std::option::Option<::std::string::String>,
3342 #[serde(
3343 rename = "returnConstraint",
3344 default,
3345 skip_serializing_if = "::std::option::Option::is_none"
3346 )]
3347 pub return_constraint: ::std::option::Option<RentalReturnConstraint>,
3348 #[serde(
3350 rename = "stationName",
3351 default,
3352 skip_serializing_if = "::std::option::Option::is_none"
3353 )]
3354 pub station_name: ::std::option::Option<::std::string::String>,
3355 #[serde(rename = "systemId")]
3357 pub system_id: ::std::string::String,
3358 #[serde(
3360 rename = "systemName",
3361 default,
3362 skip_serializing_if = "::std::option::Option::is_none"
3363 )]
3364 pub system_name: ::std::option::Option<::std::string::String>,
3365 #[serde(
3368 rename = "toStationName",
3369 default,
3370 skip_serializing_if = "::std::option::Option::is_none"
3371 )]
3372 pub to_station_name: ::std::option::Option<::std::string::String>,
3373 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3375 pub url: ::std::option::Option<::std::string::String>,
3376 }
3377
3378 impl ::std::convert::From<&Rental> for Rental {
3379 fn from(value: &Rental) -> Self {
3380 value.clone()
3381 }
3382 }
3383
3384 impl Rental {
3385 pub fn builder() -> builder::Rental {
3386 Default::default()
3387 }
3388 }
3389
3390 #[derive(
3410 :: serde :: Deserialize,
3411 :: serde :: Serialize,
3412 Clone,
3413 Copy,
3414 Debug,
3415 Eq,
3416 Hash,
3417 Ord,
3418 PartialEq,
3419 PartialOrd,
3420 )]
3421 pub enum RentalFormFactor {
3422 #[serde(rename = "BICYCLE")]
3423 Bicycle,
3424 #[serde(rename = "CARGO_BICYCLE")]
3425 CargoBicycle,
3426 #[serde(rename = "CAR")]
3427 Car,
3428 #[serde(rename = "MOPED")]
3429 Moped,
3430 #[serde(rename = "SCOOTER_STANDING")]
3431 ScooterStanding,
3432 #[serde(rename = "SCOOTER_SEATED")]
3433 ScooterSeated,
3434 #[serde(rename = "OTHER")]
3435 Other,
3436 }
3437
3438 impl ::std::convert::From<&Self> for RentalFormFactor {
3439 fn from(value: &RentalFormFactor) -> Self {
3440 value.clone()
3441 }
3442 }
3443
3444 impl ::std::fmt::Display for RentalFormFactor {
3445 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3446 match *self {
3447 Self::Bicycle => f.write_str("BICYCLE"),
3448 Self::CargoBicycle => f.write_str("CARGO_BICYCLE"),
3449 Self::Car => f.write_str("CAR"),
3450 Self::Moped => f.write_str("MOPED"),
3451 Self::ScooterStanding => f.write_str("SCOOTER_STANDING"),
3452 Self::ScooterSeated => f.write_str("SCOOTER_SEATED"),
3453 Self::Other => f.write_str("OTHER"),
3454 }
3455 }
3456 }
3457
3458 impl ::std::str::FromStr for RentalFormFactor {
3459 type Err = self::error::ConversionError;
3460 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3461 match value {
3462 "BICYCLE" => Ok(Self::Bicycle),
3463 "CARGO_BICYCLE" => Ok(Self::CargoBicycle),
3464 "CAR" => Ok(Self::Car),
3465 "MOPED" => Ok(Self::Moped),
3466 "SCOOTER_STANDING" => Ok(Self::ScooterStanding),
3467 "SCOOTER_SEATED" => Ok(Self::ScooterSeated),
3468 "OTHER" => Ok(Self::Other),
3469 _ => Err("invalid value".into()),
3470 }
3471 }
3472 }
3473
3474 impl ::std::convert::TryFrom<&str> for RentalFormFactor {
3475 type Error = self::error::ConversionError;
3476 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3477 value.parse()
3478 }
3479 }
3480
3481 impl ::std::convert::TryFrom<&::std::string::String> for RentalFormFactor {
3482 type Error = self::error::ConversionError;
3483 fn try_from(
3484 value: &::std::string::String,
3485 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3486 value.parse()
3487 }
3488 }
3489
3490 impl ::std::convert::TryFrom<::std::string::String> for RentalFormFactor {
3491 type Error = self::error::ConversionError;
3492 fn try_from(
3493 value: ::std::string::String,
3494 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3495 value.parse()
3496 }
3497 }
3498
3499 #[derive(
3520 :: serde :: Deserialize,
3521 :: serde :: Serialize,
3522 Clone,
3523 Copy,
3524 Debug,
3525 Eq,
3526 Hash,
3527 Ord,
3528 PartialEq,
3529 PartialOrd,
3530 )]
3531 pub enum RentalPropulsionType {
3532 #[serde(rename = "HUMAN")]
3533 Human,
3534 #[serde(rename = "ELECTRIC_ASSIST")]
3535 ElectricAssist,
3536 #[serde(rename = "ELECTRIC")]
3537 Electric,
3538 #[serde(rename = "COMBUSTION")]
3539 Combustion,
3540 #[serde(rename = "COMBUSTION_DIESEL")]
3541 CombustionDiesel,
3542 #[serde(rename = "HYBRID")]
3543 Hybrid,
3544 #[serde(rename = "PLUG_IN_HYBRID")]
3545 PlugInHybrid,
3546 #[serde(rename = "HYDROGEN_FUEL_CELL")]
3547 HydrogenFuelCell,
3548 }
3549
3550 impl ::std::convert::From<&Self> for RentalPropulsionType {
3551 fn from(value: &RentalPropulsionType) -> Self {
3552 value.clone()
3553 }
3554 }
3555
3556 impl ::std::fmt::Display for RentalPropulsionType {
3557 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3558 match *self {
3559 Self::Human => f.write_str("HUMAN"),
3560 Self::ElectricAssist => f.write_str("ELECTRIC_ASSIST"),
3561 Self::Electric => f.write_str("ELECTRIC"),
3562 Self::Combustion => f.write_str("COMBUSTION"),
3563 Self::CombustionDiesel => f.write_str("COMBUSTION_DIESEL"),
3564 Self::Hybrid => f.write_str("HYBRID"),
3565 Self::PlugInHybrid => f.write_str("PLUG_IN_HYBRID"),
3566 Self::HydrogenFuelCell => f.write_str("HYDROGEN_FUEL_CELL"),
3567 }
3568 }
3569 }
3570
3571 impl ::std::str::FromStr for RentalPropulsionType {
3572 type Err = self::error::ConversionError;
3573 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3574 match value {
3575 "HUMAN" => Ok(Self::Human),
3576 "ELECTRIC_ASSIST" => Ok(Self::ElectricAssist),
3577 "ELECTRIC" => Ok(Self::Electric),
3578 "COMBUSTION" => Ok(Self::Combustion),
3579 "COMBUSTION_DIESEL" => Ok(Self::CombustionDiesel),
3580 "HYBRID" => Ok(Self::Hybrid),
3581 "PLUG_IN_HYBRID" => Ok(Self::PlugInHybrid),
3582 "HYDROGEN_FUEL_CELL" => Ok(Self::HydrogenFuelCell),
3583 _ => Err("invalid value".into()),
3584 }
3585 }
3586 }
3587
3588 impl ::std::convert::TryFrom<&str> for RentalPropulsionType {
3589 type Error = self::error::ConversionError;
3590 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3591 value.parse()
3592 }
3593 }
3594
3595 impl ::std::convert::TryFrom<&::std::string::String> for RentalPropulsionType {
3596 type Error = self::error::ConversionError;
3597 fn try_from(
3598 value: &::std::string::String,
3599 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3600 value.parse()
3601 }
3602 }
3603
3604 impl ::std::convert::TryFrom<::std::string::String> for RentalPropulsionType {
3605 type Error = self::error::ConversionError;
3606 fn try_from(
3607 value: ::std::string::String,
3608 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3609 value.parse()
3610 }
3611 }
3612
3613 #[derive(
3629 :: serde :: Deserialize,
3630 :: serde :: Serialize,
3631 Clone,
3632 Copy,
3633 Debug,
3634 Eq,
3635 Hash,
3636 Ord,
3637 PartialEq,
3638 PartialOrd,
3639 )]
3640 pub enum RentalReturnConstraint {
3641 #[serde(rename = "NONE")]
3642 None,
3643 #[serde(rename = "ANY_STATION")]
3644 AnyStation,
3645 #[serde(rename = "ROUNDTRIP_STATION")]
3646 RoundtripStation,
3647 }
3648
3649 impl ::std::convert::From<&Self> for RentalReturnConstraint {
3650 fn from(value: &RentalReturnConstraint) -> Self {
3651 value.clone()
3652 }
3653 }
3654
3655 impl ::std::fmt::Display for RentalReturnConstraint {
3656 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3657 match *self {
3658 Self::None => f.write_str("NONE"),
3659 Self::AnyStation => f.write_str("ANY_STATION"),
3660 Self::RoundtripStation => f.write_str("ROUNDTRIP_STATION"),
3661 }
3662 }
3663 }
3664
3665 impl ::std::str::FromStr for RentalReturnConstraint {
3666 type Err = self::error::ConversionError;
3667 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3668 match value {
3669 "NONE" => Ok(Self::None),
3670 "ANY_STATION" => Ok(Self::AnyStation),
3671 "ROUNDTRIP_STATION" => Ok(Self::RoundtripStation),
3672 _ => Err("invalid value".into()),
3673 }
3674 }
3675 }
3676
3677 impl ::std::convert::TryFrom<&str> for RentalReturnConstraint {
3678 type Error = self::error::ConversionError;
3679 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3680 value.parse()
3681 }
3682 }
3683
3684 impl ::std::convert::TryFrom<&::std::string::String> for RentalReturnConstraint {
3685 type Error = self::error::ConversionError;
3686 fn try_from(
3687 value: &::std::string::String,
3688 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3689 value.parse()
3690 }
3691 }
3692
3693 impl ::std::convert::TryFrom<::std::string::String> for RentalReturnConstraint {
3694 type Error = self::error::ConversionError;
3695 fn try_from(
3696 value: ::std::string::String,
3697 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3698 value.parse()
3699 }
3700 }
3701
3702 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3733 pub struct RiderCategory {
3734 #[serde(
3737 rename = "eligibilityUrl",
3738 default,
3739 skip_serializing_if = "::std::option::Option::is_none"
3740 )]
3741 pub eligibility_url: ::std::option::Option<::std::string::String>,
3742 #[serde(rename = "isDefaultFareCategory")]
3745 pub is_default_fare_category: bool,
3746 #[serde(rename = "riderCategoryName")]
3748 pub rider_category_name: ::std::string::String,
3749 }
3750
3751 impl ::std::convert::From<&RiderCategory> for RiderCategory {
3752 fn from(value: &RiderCategory) -> Self {
3753 value.clone()
3754 }
3755 }
3756
3757 impl RiderCategory {
3758 pub fn builder() -> builder::RiderCategory {
3759 Default::default()
3760 }
3761 }
3762
3763 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
3848 pub struct StepInstruction {
3849 #[serde(
3852 rename = "accessRestriction",
3853 default,
3854 skip_serializing_if = "::std::option::Option::is_none"
3855 )]
3856 pub access_restriction: ::std::option::Option<::std::string::String>,
3857 pub area: bool,
3861 pub distance: f64,
3862 #[serde(
3864 rename = "elevationDown",
3865 default,
3866 skip_serializing_if = "::std::option::Option::is_none"
3867 )]
3868 pub elevation_down: ::std::option::Option<i64>,
3869 #[serde(
3871 rename = "elevationUp",
3872 default,
3873 skip_serializing_if = "::std::option::Option::is_none"
3874 )]
3875 pub elevation_up: ::std::option::Option<i64>,
3876 pub exit: ::std::string::String,
3879 #[serde(rename = "fromLevel")]
3880 pub from_level: f64,
3881 #[serde(
3883 rename = "osmWay",
3884 default,
3885 skip_serializing_if = "::std::option::Option::is_none"
3886 )]
3887 pub osm_way: ::std::option::Option<i64>,
3888 pub polyline: EncodedPolyline,
3889 #[serde(rename = "relativeDirection")]
3890 pub relative_direction: Direction,
3891 #[serde(rename = "stayOn")]
3895 pub stay_on: bool,
3896 #[serde(rename = "streetName")]
3898 pub street_name: ::std::string::String,
3899 #[serde(rename = "toLevel")]
3900 pub to_level: f64,
3901 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3904 pub toll: ::std::option::Option<bool>,
3905 }
3906
3907 impl ::std::convert::From<&StepInstruction> for StepInstruction {
3908 fn from(value: &StepInstruction) -> Self {
3909 value.clone()
3910 }
3911 }
3912
3913 impl StepInstruction {
3914 pub fn builder() -> builder::StepInstruction {
3915 Default::default()
3916 }
3917 }
3918
3919 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4039 pub struct StopTime {
4040 #[serde(rename = "agencyId")]
4041 pub agency_id: ::std::string::String,
4042 #[serde(rename = "agencyName")]
4043 pub agency_name: ::std::string::String,
4044 #[serde(rename = "agencyUrl")]
4045 pub agency_url: ::std::string::String,
4046 pub cancelled: bool,
4050 #[serde(rename = "displayName")]
4051 pub display_name: ::std::string::String,
4052 pub headsign: ::std::string::String,
4055 pub mode: Mode,
4056 #[serde(
4062 rename = "nextStops",
4063 default,
4064 skip_serializing_if = "::std::vec::Vec::is_empty"
4065 )]
4066 pub next_stops: ::std::vec::Vec<Place>,
4067 #[serde(rename = "pickupDropoffType")]
4068 pub pickup_dropoff_type: PickupDropoffType,
4069 pub place: Place,
4070 #[serde(
4076 rename = "previousStops",
4077 default,
4078 skip_serializing_if = "::std::vec::Vec::is_empty"
4079 )]
4080 pub previous_stops: ::std::vec::Vec<Place>,
4081 #[serde(rename = "realTime")]
4083 pub real_time: bool,
4084 #[serde(
4085 rename = "routeColor",
4086 default,
4087 skip_serializing_if = "::std::option::Option::is_none"
4088 )]
4089 pub route_color: ::std::option::Option<::std::string::String>,
4090 #[serde(rename = "routeLongName")]
4091 pub route_long_name: ::std::string::String,
4092 #[serde(rename = "routeShortName")]
4093 pub route_short_name: ::std::string::String,
4094 #[serde(
4095 rename = "routeTextColor",
4096 default,
4097 skip_serializing_if = "::std::option::Option::is_none"
4098 )]
4099 pub route_text_color: ::std::option::Option<::std::string::String>,
4100 #[serde(
4101 rename = "routeType",
4102 default,
4103 skip_serializing_if = "::std::option::Option::is_none"
4104 )]
4105 pub route_type: ::std::option::Option<i64>,
4106 pub source: ::std::string::String,
4108 #[serde(rename = "tripCancelled")]
4110 pub trip_cancelled: bool,
4111 #[serde(rename = "tripId")]
4112 pub trip_id: ::std::string::String,
4113 #[serde(rename = "tripShortName")]
4114 pub trip_short_name: ::std::string::String,
4115 #[serde(rename = "tripTo")]
4116 pub trip_to: Place,
4117 }
4118
4119 impl ::std::convert::From<&StopTime> for StopTime {
4120 fn from(value: &StopTime) -> Self {
4121 value.clone()
4122 }
4123 }
4124
4125 impl StopTime {
4126 pub fn builder() -> builder::StopTime {
4127 Default::default()
4128 }
4129 }
4130
4131 #[derive(
4146 :: serde :: Deserialize,
4147 :: serde :: Serialize,
4148 Clone,
4149 Copy,
4150 Debug,
4151 Eq,
4152 Hash,
4153 Ord,
4154 PartialEq,
4155 PartialOrd,
4156 )]
4157 pub enum StoptimesDirection {
4158 #[serde(rename = "EARLIER")]
4159 Earlier,
4160 #[serde(rename = "LATER")]
4161 Later,
4162 }
4163
4164 impl ::std::convert::From<&Self> for StoptimesDirection {
4165 fn from(value: &StoptimesDirection) -> Self {
4166 value.clone()
4167 }
4168 }
4169
4170 impl ::std::fmt::Display for StoptimesDirection {
4171 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4172 match *self {
4173 Self::Earlier => f.write_str("EARLIER"),
4174 Self::Later => f.write_str("LATER"),
4175 }
4176 }
4177 }
4178
4179 impl ::std::str::FromStr for StoptimesDirection {
4180 type Err = self::error::ConversionError;
4181 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4182 match value {
4183 "EARLIER" => Ok(Self::Earlier),
4184 "LATER" => Ok(Self::Later),
4185 _ => Err("invalid value".into()),
4186 }
4187 }
4188 }
4189
4190 impl ::std::convert::TryFrom<&str> for StoptimesDirection {
4191 type Error = self::error::ConversionError;
4192 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4193 value.parse()
4194 }
4195 }
4196
4197 impl ::std::convert::TryFrom<&::std::string::String> for StoptimesDirection {
4198 type Error = self::error::ConversionError;
4199 fn try_from(
4200 value: &::std::string::String,
4201 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4202 value.parse()
4203 }
4204 }
4205
4206 impl ::std::convert::TryFrom<::std::string::String> for StoptimesDirection {
4207 type Error = self::error::ConversionError;
4208 fn try_from(
4209 value: ::std::string::String,
4210 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4211 value.parse()
4212 }
4213 }
4214
4215 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4258 pub struct StoptimesResponse {
4259 #[serde(rename = "nextPageCursor")]
4264 pub next_page_cursor: ::std::string::String,
4265 pub place: Place,
4266 #[serde(rename = "previousPageCursor")]
4271 pub previous_page_cursor: ::std::string::String,
4272 #[serde(rename = "stopTimes")]
4274 pub stop_times: ::std::vec::Vec<StopTime>,
4275 }
4276
4277 impl ::std::convert::From<&StoptimesResponse> for StoptimesResponse {
4278 fn from(value: &StoptimesResponse) -> Self {
4279 value.clone()
4280 }
4281 }
4282
4283 impl StoptimesResponse {
4284 pub fn builder() -> builder::StoptimesResponse {
4285 Default::default()
4286 }
4287 }
4288
4289 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4321 pub struct TimeRange {
4322 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4326 pub end: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
4327 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4331 pub start: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
4332 }
4333
4334 impl ::std::convert::From<&TimeRange> for TimeRange {
4335 fn from(value: &TimeRange) -> Self {
4336 value.clone()
4337 }
4338 }
4339
4340 impl ::std::default::Default for TimeRange {
4341 fn default() -> Self {
4342 Self {
4343 end: Default::default(),
4344 start: Default::default(),
4345 }
4346 }
4347 }
4348
4349 impl TimeRange {
4350 pub fn builder() -> builder::TimeRange {
4351 Default::default()
4352 }
4353 }
4354
4355 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4372 #[serde(transparent)]
4373 pub struct Token(pub [f64; 2usize]);
4374 impl ::std::ops::Deref for Token {
4375 type Target = [f64; 2usize];
4376 fn deref(&self) -> &[f64; 2usize] {
4377 &self.0
4378 }
4379 }
4380
4381 impl ::std::convert::From<Token> for [f64; 2usize] {
4382 fn from(value: Token) -> Self {
4383 value.0
4384 }
4385 }
4386
4387 impl ::std::convert::From<&Token> for Token {
4388 fn from(value: &Token) -> Self {
4389 value.clone()
4390 }
4391 }
4392
4393 impl ::std::convert::From<[f64; 2usize]> for Token {
4394 fn from(value: [f64; 2usize]) -> Self {
4395 Self(value)
4396 }
4397 }
4398
4399 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4457 pub struct Transfer {
4458 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4459 pub car: ::std::option::Option<f64>,
4460 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4461 pub default: ::std::option::Option<f64>,
4462 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4463 pub foot: ::std::option::Option<f64>,
4464 #[serde(
4465 rename = "footRouted",
4466 default,
4467 skip_serializing_if = "::std::option::Option::is_none"
4468 )]
4469 pub foot_routed: ::std::option::Option<f64>,
4470 pub to: Place,
4471 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
4472 pub wheelchair: ::std::option::Option<f64>,
4473 #[serde(
4474 rename = "wheelchairRouted",
4475 default,
4476 skip_serializing_if = "::std::option::Option::is_none"
4477 )]
4478 pub wheelchair_routed: ::std::option::Option<f64>,
4479 #[serde(
4482 rename = "wheelchairUsesElevator",
4483 default,
4484 skip_serializing_if = "::std::option::Option::is_none"
4485 )]
4486 pub wheelchair_uses_elevator: ::std::option::Option<bool>,
4487 }
4488
4489 impl ::std::convert::From<&Transfer> for Transfer {
4490 fn from(value: &Transfer) -> Self {
4491 value.clone()
4492 }
4493 }
4494
4495 impl Transfer {
4496 pub fn builder() -> builder::Transfer {
4497 Default::default()
4498 }
4499 }
4500
4501 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4544 pub struct TransfersResponse {
4545 #[serde(rename = "hasCarTransfers")]
4547 pub has_car_transfers: bool,
4548 #[serde(rename = "hasFootTransfers")]
4550 pub has_foot_transfers: bool,
4551 #[serde(rename = "hasWheelchairTransfers")]
4553 pub has_wheelchair_transfers: bool,
4554 pub place: Place,
4555 pub transfers: ::std::vec::Vec<Transfer>,
4557 }
4558
4559 impl ::std::convert::From<&TransfersResponse> for TransfersResponse {
4560 fn from(value: &TransfersResponse) -> Self {
4561 value.clone()
4562 }
4563 }
4564
4565 impl TransfersResponse {
4566 pub fn builder() -> builder::TransfersResponse {
4567 Default::default()
4568 }
4569 }
4570
4571 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4601 pub struct TripInfo {
4602 #[serde(
4604 rename = "displayName",
4605 default,
4606 skip_serializing_if = "::std::option::Option::is_none"
4607 )]
4608 pub display_name: ::std::option::Option<::std::string::String>,
4609 #[serde(
4611 rename = "routeShortName",
4612 default,
4613 skip_serializing_if = "::std::option::Option::is_none"
4614 )]
4615 pub route_short_name: ::std::option::Option<::std::string::String>,
4616 #[serde(rename = "tripId")]
4618 pub trip_id: ::std::string::String,
4619 }
4620
4621 impl ::std::convert::From<&TripInfo> for TripInfo {
4622 fn from(value: &TripInfo) -> Self {
4623 value.clone()
4624 }
4625 }
4626
4627 impl TripInfo {
4628 pub fn builder() -> builder::TripInfo {
4629 Default::default()
4630 }
4631 }
4632
4633 #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
4712 pub struct TripSegment {
4713 pub arrival: ::chrono::DateTime<::chrono::offset::Utc>,
4715 pub departure: ::chrono::DateTime<::chrono::offset::Utc>,
4717 pub distance: f64,
4718 pub from: Place,
4719 pub mode: Mode,
4720 pub polyline: ::std::string::String,
4723 #[serde(rename = "realTime")]
4725 pub real_time: bool,
4726 #[serde(
4727 rename = "routeColor",
4728 default,
4729 skip_serializing_if = "::std::option::Option::is_none"
4730 )]
4731 pub route_color: ::std::option::Option<::std::string::String>,
4732 #[serde(rename = "scheduledArrival")]
4734 pub scheduled_arrival: ::chrono::DateTime<::chrono::offset::Utc>,
4735 #[serde(rename = "scheduledDeparture")]
4737 pub scheduled_departure: ::chrono::DateTime<::chrono::offset::Utc>,
4738 pub to: Place,
4739 pub trips: ::std::vec::Vec<TripInfo>,
4740 }
4741
4742 impl ::std::convert::From<&TripSegment> for TripSegment {
4743 fn from(value: &TripSegment) -> Self {
4744 value.clone()
4745 }
4746 }
4747
4748 impl TripSegment {
4749 pub fn builder() -> builder::TripSegment {
4750 Default::default()
4751 }
4752 }
4753
4754 #[derive(
4775 :: serde :: Deserialize,
4776 :: serde :: Serialize,
4777 Clone,
4778 Copy,
4779 Debug,
4780 Eq,
4781 Hash,
4782 Ord,
4783 PartialEq,
4784 PartialOrd,
4785 )]
4786 pub enum VertexType {
4787 #[serde(rename = "NORMAL")]
4788 Normal,
4789 #[serde(rename = "BIKESHARE")]
4790 Bikeshare,
4791 #[serde(rename = "TRANSIT")]
4792 Transit,
4793 }
4794
4795 impl ::std::convert::From<&Self> for VertexType {
4796 fn from(value: &VertexType) -> Self {
4797 value.clone()
4798 }
4799 }
4800
4801 impl ::std::fmt::Display for VertexType {
4802 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4803 match *self {
4804 Self::Normal => f.write_str("NORMAL"),
4805 Self::Bikeshare => f.write_str("BIKESHARE"),
4806 Self::Transit => f.write_str("TRANSIT"),
4807 }
4808 }
4809 }
4810
4811 impl ::std::str::FromStr for VertexType {
4812 type Err = self::error::ConversionError;
4813 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4814 match value {
4815 "NORMAL" => Ok(Self::Normal),
4816 "BIKESHARE" => Ok(Self::Bikeshare),
4817 "TRANSIT" => Ok(Self::Transit),
4818 _ => Err("invalid value".into()),
4819 }
4820 }
4821 }
4822
4823 impl ::std::convert::TryFrom<&str> for VertexType {
4824 type Error = self::error::ConversionError;
4825 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
4826 value.parse()
4827 }
4828 }
4829
4830 impl ::std::convert::TryFrom<&::std::string::String> for VertexType {
4831 type Error = self::error::ConversionError;
4832 fn try_from(
4833 value: &::std::string::String,
4834 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4835 value.parse()
4836 }
4837 }
4838
4839 impl ::std::convert::TryFrom<::std::string::String> for VertexType {
4840 type Error = self::error::ConversionError;
4841 fn try_from(
4842 value: ::std::string::String,
4843 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4844 value.parse()
4845 }
4846 }
4847
4848 pub mod builder {
4850 #[derive(Clone, Debug)]
4851 pub struct Alert {
4852 cause: ::std::result::Result<
4853 ::std::option::Option<super::AlertCause>,
4854 ::std::string::String,
4855 >,
4856 cause_detail: ::std::result::Result<
4857 ::std::option::Option<::std::string::String>,
4858 ::std::string::String,
4859 >,
4860 communication_period:
4861 ::std::result::Result<::std::vec::Vec<super::TimeRange>, ::std::string::String>,
4862 description_text: ::std::result::Result<::std::string::String, ::std::string::String>,
4863 effect: ::std::result::Result<
4864 ::std::option::Option<super::AlertEffect>,
4865 ::std::string::String,
4866 >,
4867 effect_detail: ::std::result::Result<
4868 ::std::option::Option<::std::string::String>,
4869 ::std::string::String,
4870 >,
4871 header_text: ::std::result::Result<::std::string::String, ::std::string::String>,
4872 image_alternative_text: ::std::result::Result<
4873 ::std::option::Option<::std::string::String>,
4874 ::std::string::String,
4875 >,
4876 image_media_type: ::std::result::Result<
4877 ::std::option::Option<::std::string::String>,
4878 ::std::string::String,
4879 >,
4880 image_url: ::std::result::Result<
4881 ::std::option::Option<::std::string::String>,
4882 ::std::string::String,
4883 >,
4884 impact_period:
4885 ::std::result::Result<::std::vec::Vec<super::TimeRange>, ::std::string::String>,
4886 severity_level: ::std::result::Result<
4887 ::std::option::Option<super::AlertSeverityLevel>,
4888 ::std::string::String,
4889 >,
4890 tts_description_text: ::std::result::Result<
4891 ::std::option::Option<::std::string::String>,
4892 ::std::string::String,
4893 >,
4894 tts_header_text: ::std::result::Result<
4895 ::std::option::Option<::std::string::String>,
4896 ::std::string::String,
4897 >,
4898 url: ::std::result::Result<
4899 ::std::option::Option<::std::string::String>,
4900 ::std::string::String,
4901 >,
4902 }
4903
4904 impl ::std::default::Default for Alert {
4905 fn default() -> Self {
4906 Self {
4907 cause: Ok(Default::default()),
4908 cause_detail: Ok(Default::default()),
4909 communication_period: Ok(Default::default()),
4910 description_text: Err("no value supplied for description_text".to_string()),
4911 effect: Ok(Default::default()),
4912 effect_detail: Ok(Default::default()),
4913 header_text: Err("no value supplied for header_text".to_string()),
4914 image_alternative_text: Ok(Default::default()),
4915 image_media_type: Ok(Default::default()),
4916 image_url: Ok(Default::default()),
4917 impact_period: Ok(Default::default()),
4918 severity_level: Ok(Default::default()),
4919 tts_description_text: Ok(Default::default()),
4920 tts_header_text: Ok(Default::default()),
4921 url: Ok(Default::default()),
4922 }
4923 }
4924 }
4925
4926 impl Alert {
4927 pub fn cause<T>(mut self, value: T) -> Self
4928 where
4929 T: ::std::convert::TryInto<::std::option::Option<super::AlertCause>>,
4930 T::Error: ::std::fmt::Display,
4931 {
4932 self.cause = value
4933 .try_into()
4934 .map_err(|e| format!("error converting supplied value for cause: {}", e));
4935 self
4936 }
4937 pub fn cause_detail<T>(mut self, value: T) -> Self
4938 where
4939 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4940 T::Error: ::std::fmt::Display,
4941 {
4942 self.cause_detail = value.try_into().map_err(|e| {
4943 format!("error converting supplied value for cause_detail: {}", e)
4944 });
4945 self
4946 }
4947 pub fn communication_period<T>(mut self, value: T) -> Self
4948 where
4949 T: ::std::convert::TryInto<::std::vec::Vec<super::TimeRange>>,
4950 T::Error: ::std::fmt::Display,
4951 {
4952 self.communication_period = value.try_into().map_err(|e| {
4953 format!(
4954 "error converting supplied value for communication_period: {}",
4955 e
4956 )
4957 });
4958 self
4959 }
4960 pub fn description_text<T>(mut self, value: T) -> Self
4961 where
4962 T: ::std::convert::TryInto<::std::string::String>,
4963 T::Error: ::std::fmt::Display,
4964 {
4965 self.description_text = value.try_into().map_err(|e| {
4966 format!(
4967 "error converting supplied value for description_text: {}",
4968 e
4969 )
4970 });
4971 self
4972 }
4973 pub fn effect<T>(mut self, value: T) -> Self
4974 where
4975 T: ::std::convert::TryInto<::std::option::Option<super::AlertEffect>>,
4976 T::Error: ::std::fmt::Display,
4977 {
4978 self.effect = value
4979 .try_into()
4980 .map_err(|e| format!("error converting supplied value for effect: {}", e));
4981 self
4982 }
4983 pub fn effect_detail<T>(mut self, value: T) -> Self
4984 where
4985 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4986 T::Error: ::std::fmt::Display,
4987 {
4988 self.effect_detail = value.try_into().map_err(|e| {
4989 format!("error converting supplied value for effect_detail: {}", e)
4990 });
4991 self
4992 }
4993 pub fn header_text<T>(mut self, value: T) -> Self
4994 where
4995 T: ::std::convert::TryInto<::std::string::String>,
4996 T::Error: ::std::fmt::Display,
4997 {
4998 self.header_text = value
4999 .try_into()
5000 .map_err(|e| format!("error converting supplied value for header_text: {}", e));
5001 self
5002 }
5003 pub fn image_alternative_text<T>(mut self, value: T) -> Self
5004 where
5005 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5006 T::Error: ::std::fmt::Display,
5007 {
5008 self.image_alternative_text = value.try_into().map_err(|e| {
5009 format!(
5010 "error converting supplied value for image_alternative_text: {}",
5011 e
5012 )
5013 });
5014 self
5015 }
5016 pub fn image_media_type<T>(mut self, value: T) -> Self
5017 where
5018 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5019 T::Error: ::std::fmt::Display,
5020 {
5021 self.image_media_type = value.try_into().map_err(|e| {
5022 format!(
5023 "error converting supplied value for image_media_type: {}",
5024 e
5025 )
5026 });
5027 self
5028 }
5029 pub fn image_url<T>(mut self, value: T) -> Self
5030 where
5031 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5032 T::Error: ::std::fmt::Display,
5033 {
5034 self.image_url = value
5035 .try_into()
5036 .map_err(|e| format!("error converting supplied value for image_url: {}", e));
5037 self
5038 }
5039 pub fn impact_period<T>(mut self, value: T) -> Self
5040 where
5041 T: ::std::convert::TryInto<::std::vec::Vec<super::TimeRange>>,
5042 T::Error: ::std::fmt::Display,
5043 {
5044 self.impact_period = value.try_into().map_err(|e| {
5045 format!("error converting supplied value for impact_period: {}", e)
5046 });
5047 self
5048 }
5049 pub fn severity_level<T>(mut self, value: T) -> Self
5050 where
5051 T: ::std::convert::TryInto<::std::option::Option<super::AlertSeverityLevel>>,
5052 T::Error: ::std::fmt::Display,
5053 {
5054 self.severity_level = value.try_into().map_err(|e| {
5055 format!("error converting supplied value for severity_level: {}", e)
5056 });
5057 self
5058 }
5059 pub fn tts_description_text<T>(mut self, value: T) -> Self
5060 where
5061 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5062 T::Error: ::std::fmt::Display,
5063 {
5064 self.tts_description_text = value.try_into().map_err(|e| {
5065 format!(
5066 "error converting supplied value for tts_description_text: {}",
5067 e
5068 )
5069 });
5070 self
5071 }
5072 pub fn tts_header_text<T>(mut self, value: T) -> Self
5073 where
5074 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5075 T::Error: ::std::fmt::Display,
5076 {
5077 self.tts_header_text = value.try_into().map_err(|e| {
5078 format!("error converting supplied value for tts_header_text: {}", e)
5079 });
5080 self
5081 }
5082 pub fn url<T>(mut self, value: T) -> Self
5083 where
5084 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5085 T::Error: ::std::fmt::Display,
5086 {
5087 self.url = value
5088 .try_into()
5089 .map_err(|e| format!("error converting supplied value for url: {}", e));
5090 self
5091 }
5092 }
5093
5094 impl ::std::convert::TryFrom<Alert> for super::Alert {
5095 type Error = super::error::ConversionError;
5096 fn try_from(
5097 value: Alert,
5098 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5099 Ok(Self {
5100 cause: value.cause?,
5101 cause_detail: value.cause_detail?,
5102 communication_period: value.communication_period?,
5103 description_text: value.description_text?,
5104 effect: value.effect?,
5105 effect_detail: value.effect_detail?,
5106 header_text: value.header_text?,
5107 image_alternative_text: value.image_alternative_text?,
5108 image_media_type: value.image_media_type?,
5109 image_url: value.image_url?,
5110 impact_period: value.impact_period?,
5111 severity_level: value.severity_level?,
5112 tts_description_text: value.tts_description_text?,
5113 tts_header_text: value.tts_header_text?,
5114 url: value.url?,
5115 })
5116 }
5117 }
5118
5119 impl ::std::convert::From<super::Alert> for Alert {
5120 fn from(value: super::Alert) -> Self {
5121 Self {
5122 cause: Ok(value.cause),
5123 cause_detail: Ok(value.cause_detail),
5124 communication_period: Ok(value.communication_period),
5125 description_text: Ok(value.description_text),
5126 effect: Ok(value.effect),
5127 effect_detail: Ok(value.effect_detail),
5128 header_text: Ok(value.header_text),
5129 image_alternative_text: Ok(value.image_alternative_text),
5130 image_media_type: Ok(value.image_media_type),
5131 image_url: Ok(value.image_url),
5132 impact_period: Ok(value.impact_period),
5133 severity_level: Ok(value.severity_level),
5134 tts_description_text: Ok(value.tts_description_text),
5135 tts_header_text: Ok(value.tts_header_text),
5136 url: Ok(value.url),
5137 }
5138 }
5139 }
5140
5141 #[derive(Clone, Debug)]
5142 pub struct Area {
5143 admin_level: ::std::result::Result<f64, ::std::string::String>,
5144 default: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
5145 matched: ::std::result::Result<bool, ::std::string::String>,
5146 name: ::std::result::Result<::std::string::String, ::std::string::String>,
5147 unique: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
5148 }
5149
5150 impl ::std::default::Default for Area {
5151 fn default() -> Self {
5152 Self {
5153 admin_level: Err("no value supplied for admin_level".to_string()),
5154 default: Ok(Default::default()),
5155 matched: Err("no value supplied for matched".to_string()),
5156 name: Err("no value supplied for name".to_string()),
5157 unique: Ok(Default::default()),
5158 }
5159 }
5160 }
5161
5162 impl Area {
5163 pub fn admin_level<T>(mut self, value: T) -> Self
5164 where
5165 T: ::std::convert::TryInto<f64>,
5166 T::Error: ::std::fmt::Display,
5167 {
5168 self.admin_level = value
5169 .try_into()
5170 .map_err(|e| format!("error converting supplied value for admin_level: {}", e));
5171 self
5172 }
5173 pub fn default<T>(mut self, value: T) -> Self
5174 where
5175 T: ::std::convert::TryInto<::std::option::Option<bool>>,
5176 T::Error: ::std::fmt::Display,
5177 {
5178 self.default = value
5179 .try_into()
5180 .map_err(|e| format!("error converting supplied value for default: {}", e));
5181 self
5182 }
5183 pub fn matched<T>(mut self, value: T) -> Self
5184 where
5185 T: ::std::convert::TryInto<bool>,
5186 T::Error: ::std::fmt::Display,
5187 {
5188 self.matched = value
5189 .try_into()
5190 .map_err(|e| format!("error converting supplied value for matched: {}", e));
5191 self
5192 }
5193 pub fn name<T>(mut self, value: T) -> Self
5194 where
5195 T: ::std::convert::TryInto<::std::string::String>,
5196 T::Error: ::std::fmt::Display,
5197 {
5198 self.name = value
5199 .try_into()
5200 .map_err(|e| format!("error converting supplied value for name: {}", e));
5201 self
5202 }
5203 pub fn unique<T>(mut self, value: T) -> Self
5204 where
5205 T: ::std::convert::TryInto<::std::option::Option<bool>>,
5206 T::Error: ::std::fmt::Display,
5207 {
5208 self.unique = value
5209 .try_into()
5210 .map_err(|e| format!("error converting supplied value for unique: {}", e));
5211 self
5212 }
5213 }
5214
5215 impl ::std::convert::TryFrom<Area> for super::Area {
5216 type Error = super::error::ConversionError;
5217 fn try_from(value: Area) -> ::std::result::Result<Self, super::error::ConversionError> {
5218 Ok(Self {
5219 admin_level: value.admin_level?,
5220 default: value.default?,
5221 matched: value.matched?,
5222 name: value.name?,
5223 unique: value.unique?,
5224 })
5225 }
5226 }
5227
5228 impl ::std::convert::From<super::Area> for Area {
5229 fn from(value: super::Area) -> Self {
5230 Self {
5231 admin_level: Ok(value.admin_level),
5232 default: Ok(value.default),
5233 matched: Ok(value.matched),
5234 name: Ok(value.name),
5235 unique: Ok(value.unique),
5236 }
5237 }
5238 }
5239
5240 #[derive(Clone, Debug)]
5241 pub struct Duration {
5242 duration: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
5243 }
5244
5245 impl ::std::default::Default for Duration {
5246 fn default() -> Self {
5247 Self {
5248 duration: Ok(Default::default()),
5249 }
5250 }
5251 }
5252
5253 impl Duration {
5254 pub fn duration<T>(mut self, value: T) -> Self
5255 where
5256 T: ::std::convert::TryInto<::std::option::Option<f64>>,
5257 T::Error: ::std::fmt::Display,
5258 {
5259 self.duration = value
5260 .try_into()
5261 .map_err(|e| format!("error converting supplied value for duration: {}", e));
5262 self
5263 }
5264 }
5265
5266 impl ::std::convert::TryFrom<Duration> for super::Duration {
5267 type Error = super::error::ConversionError;
5268 fn try_from(
5269 value: Duration,
5270 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5271 Ok(Self {
5272 duration: value.duration?,
5273 })
5274 }
5275 }
5276
5277 impl ::std::convert::From<super::Duration> for Duration {
5278 fn from(value: super::Duration) -> Self {
5279 Self {
5280 duration: Ok(value.duration),
5281 }
5282 }
5283 }
5284
5285 #[derive(Clone, Debug)]
5286 pub struct EncodedPolyline {
5287 length: ::std::result::Result<u64, ::std::string::String>,
5288 points: ::std::result::Result<::std::string::String, ::std::string::String>,
5289 precision: ::std::result::Result<i64, ::std::string::String>,
5290 }
5291
5292 impl ::std::default::Default for EncodedPolyline {
5293 fn default() -> Self {
5294 Self {
5295 length: Err("no value supplied for length".to_string()),
5296 points: Err("no value supplied for points".to_string()),
5297 precision: Err("no value supplied for precision".to_string()),
5298 }
5299 }
5300 }
5301
5302 impl EncodedPolyline {
5303 pub fn length<T>(mut self, value: T) -> Self
5304 where
5305 T: ::std::convert::TryInto<u64>,
5306 T::Error: ::std::fmt::Display,
5307 {
5308 self.length = value
5309 .try_into()
5310 .map_err(|e| format!("error converting supplied value for length: {}", e));
5311 self
5312 }
5313 pub fn points<T>(mut self, value: T) -> Self
5314 where
5315 T: ::std::convert::TryInto<::std::string::String>,
5316 T::Error: ::std::fmt::Display,
5317 {
5318 self.points = value
5319 .try_into()
5320 .map_err(|e| format!("error converting supplied value for points: {}", e));
5321 self
5322 }
5323 pub fn precision<T>(mut self, value: T) -> Self
5324 where
5325 T: ::std::convert::TryInto<i64>,
5326 T::Error: ::std::fmt::Display,
5327 {
5328 self.precision = value
5329 .try_into()
5330 .map_err(|e| format!("error converting supplied value for precision: {}", e));
5331 self
5332 }
5333 }
5334
5335 impl ::std::convert::TryFrom<EncodedPolyline> for super::EncodedPolyline {
5336 type Error = super::error::ConversionError;
5337 fn try_from(
5338 value: EncodedPolyline,
5339 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5340 Ok(Self {
5341 length: value.length?,
5342 points: value.points?,
5343 precision: value.precision?,
5344 })
5345 }
5346 }
5347
5348 impl ::std::convert::From<super::EncodedPolyline> for EncodedPolyline {
5349 fn from(value: super::EncodedPolyline) -> Self {
5350 Self {
5351 length: Ok(value.length),
5352 points: Ok(value.points),
5353 precision: Ok(value.precision),
5354 }
5355 }
5356 }
5357
5358 #[derive(Clone, Debug)]
5359 pub struct FareMedia {
5360 fare_media_name: ::std::result::Result<
5361 ::std::option::Option<::std::string::String>,
5362 ::std::string::String,
5363 >,
5364 fare_media_type: ::std::result::Result<super::FareMediaType, ::std::string::String>,
5365 }
5366
5367 impl ::std::default::Default for FareMedia {
5368 fn default() -> Self {
5369 Self {
5370 fare_media_name: Ok(Default::default()),
5371 fare_media_type: Err("no value supplied for fare_media_type".to_string()),
5372 }
5373 }
5374 }
5375
5376 impl FareMedia {
5377 pub fn fare_media_name<T>(mut self, value: T) -> Self
5378 where
5379 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5380 T::Error: ::std::fmt::Display,
5381 {
5382 self.fare_media_name = value.try_into().map_err(|e| {
5383 format!("error converting supplied value for fare_media_name: {}", e)
5384 });
5385 self
5386 }
5387 pub fn fare_media_type<T>(mut self, value: T) -> Self
5388 where
5389 T: ::std::convert::TryInto<super::FareMediaType>,
5390 T::Error: ::std::fmt::Display,
5391 {
5392 self.fare_media_type = value.try_into().map_err(|e| {
5393 format!("error converting supplied value for fare_media_type: {}", e)
5394 });
5395 self
5396 }
5397 }
5398
5399 impl ::std::convert::TryFrom<FareMedia> for super::FareMedia {
5400 type Error = super::error::ConversionError;
5401 fn try_from(
5402 value: FareMedia,
5403 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5404 Ok(Self {
5405 fare_media_name: value.fare_media_name?,
5406 fare_media_type: value.fare_media_type?,
5407 })
5408 }
5409 }
5410
5411 impl ::std::convert::From<super::FareMedia> for FareMedia {
5412 fn from(value: super::FareMedia) -> Self {
5413 Self {
5414 fare_media_name: Ok(value.fare_media_name),
5415 fare_media_type: Ok(value.fare_media_type),
5416 }
5417 }
5418 }
5419
5420 #[derive(Clone, Debug)]
5421 pub struct FareProduct {
5422 amount: ::std::result::Result<f64, ::std::string::String>,
5423 currency: ::std::result::Result<::std::string::String, ::std::string::String>,
5424 media: ::std::result::Result<
5425 ::std::option::Option<super::FareMedia>,
5426 ::std::string::String,
5427 >,
5428 name: ::std::result::Result<::std::string::String, ::std::string::String>,
5429 rider_category: ::std::result::Result<
5430 ::std::option::Option<super::RiderCategory>,
5431 ::std::string::String,
5432 >,
5433 }
5434
5435 impl ::std::default::Default for FareProduct {
5436 fn default() -> Self {
5437 Self {
5438 amount: Err("no value supplied for amount".to_string()),
5439 currency: Err("no value supplied for currency".to_string()),
5440 media: Ok(Default::default()),
5441 name: Err("no value supplied for name".to_string()),
5442 rider_category: Ok(Default::default()),
5443 }
5444 }
5445 }
5446
5447 impl FareProduct {
5448 pub fn amount<T>(mut self, value: T) -> Self
5449 where
5450 T: ::std::convert::TryInto<f64>,
5451 T::Error: ::std::fmt::Display,
5452 {
5453 self.amount = value
5454 .try_into()
5455 .map_err(|e| format!("error converting supplied value for amount: {}", e));
5456 self
5457 }
5458 pub fn currency<T>(mut self, value: T) -> Self
5459 where
5460 T: ::std::convert::TryInto<::std::string::String>,
5461 T::Error: ::std::fmt::Display,
5462 {
5463 self.currency = value
5464 .try_into()
5465 .map_err(|e| format!("error converting supplied value for currency: {}", e));
5466 self
5467 }
5468 pub fn media<T>(mut self, value: T) -> Self
5469 where
5470 T: ::std::convert::TryInto<::std::option::Option<super::FareMedia>>,
5471 T::Error: ::std::fmt::Display,
5472 {
5473 self.media = value
5474 .try_into()
5475 .map_err(|e| format!("error converting supplied value for media: {}", e));
5476 self
5477 }
5478 pub fn name<T>(mut self, value: T) -> Self
5479 where
5480 T: ::std::convert::TryInto<::std::string::String>,
5481 T::Error: ::std::fmt::Display,
5482 {
5483 self.name = value
5484 .try_into()
5485 .map_err(|e| format!("error converting supplied value for name: {}", e));
5486 self
5487 }
5488 pub fn rider_category<T>(mut self, value: T) -> Self
5489 where
5490 T: ::std::convert::TryInto<::std::option::Option<super::RiderCategory>>,
5491 T::Error: ::std::fmt::Display,
5492 {
5493 self.rider_category = value.try_into().map_err(|e| {
5494 format!("error converting supplied value for rider_category: {}", e)
5495 });
5496 self
5497 }
5498 }
5499
5500 impl ::std::convert::TryFrom<FareProduct> for super::FareProduct {
5501 type Error = super::error::ConversionError;
5502 fn try_from(
5503 value: FareProduct,
5504 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5505 Ok(Self {
5506 amount: value.amount?,
5507 currency: value.currency?,
5508 media: value.media?,
5509 name: value.name?,
5510 rider_category: value.rider_category?,
5511 })
5512 }
5513 }
5514
5515 impl ::std::convert::From<super::FareProduct> for FareProduct {
5516 fn from(value: super::FareProduct) -> Self {
5517 Self {
5518 amount: Ok(value.amount),
5519 currency: Ok(value.currency),
5520 media: Ok(value.media),
5521 name: Ok(value.name),
5522 rider_category: Ok(value.rider_category),
5523 }
5524 }
5525 }
5526
5527 #[derive(Clone, Debug)]
5528 pub struct FareTransfer {
5529 effective_fare_leg_products: ::std::result::Result<
5530 ::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<super::FareProduct>>>,
5531 ::std::string::String,
5532 >,
5533 rule: ::std::result::Result<
5534 ::std::option::Option<super::FareTransferRule>,
5535 ::std::string::String,
5536 >,
5537 transfer_products:
5538 ::std::result::Result<::std::vec::Vec<super::FareProduct>, ::std::string::String>,
5539 }
5540
5541 impl ::std::default::Default for FareTransfer {
5542 fn default() -> Self {
5543 Self {
5544 effective_fare_leg_products: Err(
5545 "no value supplied for effective_fare_leg_products".to_string(),
5546 ),
5547 rule: Ok(Default::default()),
5548 transfer_products: Ok(Default::default()),
5549 }
5550 }
5551 }
5552
5553 impl FareTransfer {
5554 pub fn effective_fare_leg_products<T>(mut self, value: T) -> Self
5555 where
5556 T: ::std::convert::TryInto<
5557 ::std::vec::Vec<::std::vec::Vec<::std::vec::Vec<super::FareProduct>>>,
5558 >,
5559 T::Error: ::std::fmt::Display,
5560 {
5561 self.effective_fare_leg_products = value.try_into().map_err(|e| {
5562 format!(
5563 "error converting supplied value for effective_fare_leg_products: {}",
5564 e
5565 )
5566 });
5567 self
5568 }
5569 pub fn rule<T>(mut self, value: T) -> Self
5570 where
5571 T: ::std::convert::TryInto<::std::option::Option<super::FareTransferRule>>,
5572 T::Error: ::std::fmt::Display,
5573 {
5574 self.rule = value
5575 .try_into()
5576 .map_err(|e| format!("error converting supplied value for rule: {}", e));
5577 self
5578 }
5579 pub fn transfer_products<T>(mut self, value: T) -> Self
5580 where
5581 T: ::std::convert::TryInto<::std::vec::Vec<super::FareProduct>>,
5582 T::Error: ::std::fmt::Display,
5583 {
5584 self.transfer_products = value.try_into().map_err(|e| {
5585 format!(
5586 "error converting supplied value for transfer_products: {}",
5587 e
5588 )
5589 });
5590 self
5591 }
5592 }
5593
5594 impl ::std::convert::TryFrom<FareTransfer> for super::FareTransfer {
5595 type Error = super::error::ConversionError;
5596 fn try_from(
5597 value: FareTransfer,
5598 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5599 Ok(Self {
5600 effective_fare_leg_products: value.effective_fare_leg_products?,
5601 rule: value.rule?,
5602 transfer_products: value.transfer_products?,
5603 })
5604 }
5605 }
5606
5607 impl ::std::convert::From<super::FareTransfer> for FareTransfer {
5608 fn from(value: super::FareTransfer) -> Self {
5609 Self {
5610 effective_fare_leg_products: Ok(value.effective_fare_leg_products),
5611 rule: Ok(value.rule),
5612 transfer_products: Ok(value.transfer_products),
5613 }
5614 }
5615 }
5616
5617 #[derive(Clone, Debug)]
5618 pub struct InitialResponse {
5619 lat: ::std::result::Result<f64, ::std::string::String>,
5620 lon: ::std::result::Result<f64, ::std::string::String>,
5621 zoom: ::std::result::Result<f64, ::std::string::String>,
5622 }
5623
5624 impl ::std::default::Default for InitialResponse {
5625 fn default() -> Self {
5626 Self {
5627 lat: Err("no value supplied for lat".to_string()),
5628 lon: Err("no value supplied for lon".to_string()),
5629 zoom: Err("no value supplied for zoom".to_string()),
5630 }
5631 }
5632 }
5633
5634 impl InitialResponse {
5635 pub fn lat<T>(mut self, value: T) -> Self
5636 where
5637 T: ::std::convert::TryInto<f64>,
5638 T::Error: ::std::fmt::Display,
5639 {
5640 self.lat = value
5641 .try_into()
5642 .map_err(|e| format!("error converting supplied value for lat: {}", e));
5643 self
5644 }
5645 pub fn lon<T>(mut self, value: T) -> Self
5646 where
5647 T: ::std::convert::TryInto<f64>,
5648 T::Error: ::std::fmt::Display,
5649 {
5650 self.lon = value
5651 .try_into()
5652 .map_err(|e| format!("error converting supplied value for lon: {}", e));
5653 self
5654 }
5655 pub fn zoom<T>(mut self, value: T) -> Self
5656 where
5657 T: ::std::convert::TryInto<f64>,
5658 T::Error: ::std::fmt::Display,
5659 {
5660 self.zoom = value
5661 .try_into()
5662 .map_err(|e| format!("error converting supplied value for zoom: {}", e));
5663 self
5664 }
5665 }
5666
5667 impl ::std::convert::TryFrom<InitialResponse> for super::InitialResponse {
5668 type Error = super::error::ConversionError;
5669 fn try_from(
5670 value: InitialResponse,
5671 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5672 Ok(Self {
5673 lat: value.lat?,
5674 lon: value.lon?,
5675 zoom: value.zoom?,
5676 })
5677 }
5678 }
5679
5680 impl ::std::convert::From<super::InitialResponse> for InitialResponse {
5681 fn from(value: super::InitialResponse) -> Self {
5682 Self {
5683 lat: Ok(value.lat),
5684 lon: Ok(value.lon),
5685 zoom: Ok(value.zoom),
5686 }
5687 }
5688 }
5689
5690 #[derive(Clone, Debug)]
5691 pub struct Itinerary {
5692 duration: ::std::result::Result<i64, ::std::string::String>,
5693 end_time: ::std::result::Result<
5694 ::chrono::DateTime<::chrono::offset::Utc>,
5695 ::std::string::String,
5696 >,
5697 fare_transfers:
5698 ::std::result::Result<::std::vec::Vec<super::FareTransfer>, ::std::string::String>,
5699 legs: ::std::result::Result<::std::vec::Vec<super::Leg>, ::std::string::String>,
5700 start_time: ::std::result::Result<
5701 ::chrono::DateTime<::chrono::offset::Utc>,
5702 ::std::string::String,
5703 >,
5704 transfers: ::std::result::Result<i64, ::std::string::String>,
5705 }
5706
5707 impl ::std::default::Default for Itinerary {
5708 fn default() -> Self {
5709 Self {
5710 duration: Err("no value supplied for duration".to_string()),
5711 end_time: Err("no value supplied for end_time".to_string()),
5712 fare_transfers: Ok(Default::default()),
5713 legs: Err("no value supplied for legs".to_string()),
5714 start_time: Err("no value supplied for start_time".to_string()),
5715 transfers: Err("no value supplied for transfers".to_string()),
5716 }
5717 }
5718 }
5719
5720 impl Itinerary {
5721 pub fn duration<T>(mut self, value: T) -> Self
5722 where
5723 T: ::std::convert::TryInto<i64>,
5724 T::Error: ::std::fmt::Display,
5725 {
5726 self.duration = value
5727 .try_into()
5728 .map_err(|e| format!("error converting supplied value for duration: {}", e));
5729 self
5730 }
5731 pub fn end_time<T>(mut self, value: T) -> Self
5732 where
5733 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
5734 T::Error: ::std::fmt::Display,
5735 {
5736 self.end_time = value
5737 .try_into()
5738 .map_err(|e| format!("error converting supplied value for end_time: {}", e));
5739 self
5740 }
5741 pub fn fare_transfers<T>(mut self, value: T) -> Self
5742 where
5743 T: ::std::convert::TryInto<::std::vec::Vec<super::FareTransfer>>,
5744 T::Error: ::std::fmt::Display,
5745 {
5746 self.fare_transfers = value.try_into().map_err(|e| {
5747 format!("error converting supplied value for fare_transfers: {}", e)
5748 });
5749 self
5750 }
5751 pub fn legs<T>(mut self, value: T) -> Self
5752 where
5753 T: ::std::convert::TryInto<::std::vec::Vec<super::Leg>>,
5754 T::Error: ::std::fmt::Display,
5755 {
5756 self.legs = value
5757 .try_into()
5758 .map_err(|e| format!("error converting supplied value for legs: {}", e));
5759 self
5760 }
5761 pub fn start_time<T>(mut self, value: T) -> Self
5762 where
5763 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
5764 T::Error: ::std::fmt::Display,
5765 {
5766 self.start_time = value
5767 .try_into()
5768 .map_err(|e| format!("error converting supplied value for start_time: {}", e));
5769 self
5770 }
5771 pub fn transfers<T>(mut self, value: T) -> Self
5772 where
5773 T: ::std::convert::TryInto<i64>,
5774 T::Error: ::std::fmt::Display,
5775 {
5776 self.transfers = value
5777 .try_into()
5778 .map_err(|e| format!("error converting supplied value for transfers: {}", e));
5779 self
5780 }
5781 }
5782
5783 impl ::std::convert::TryFrom<Itinerary> for super::Itinerary {
5784 type Error = super::error::ConversionError;
5785 fn try_from(
5786 value: Itinerary,
5787 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5788 Ok(Self {
5789 duration: value.duration?,
5790 end_time: value.end_time?,
5791 fare_transfers: value.fare_transfers?,
5792 legs: value.legs?,
5793 start_time: value.start_time?,
5794 transfers: value.transfers?,
5795 })
5796 }
5797 }
5798
5799 impl ::std::convert::From<super::Itinerary> for Itinerary {
5800 fn from(value: super::Itinerary) -> Self {
5801 Self {
5802 duration: Ok(value.duration),
5803 end_time: Ok(value.end_time),
5804 fare_transfers: Ok(value.fare_transfers),
5805 legs: Ok(value.legs),
5806 start_time: Ok(value.start_time),
5807 transfers: Ok(value.transfers),
5808 }
5809 }
5810 }
5811
5812 #[derive(Clone, Debug)]
5813 pub struct Leg {
5814 agency_id: ::std::result::Result<
5815 ::std::option::Option<::std::string::String>,
5816 ::std::string::String,
5817 >,
5818 agency_name: ::std::result::Result<
5819 ::std::option::Option<::std::string::String>,
5820 ::std::string::String,
5821 >,
5822 agency_url: ::std::result::Result<
5823 ::std::option::Option<::std::string::String>,
5824 ::std::string::String,
5825 >,
5826 alerts: ::std::result::Result<::std::vec::Vec<super::Alert>, ::std::string::String>,
5827 cancelled: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
5828 display_name: ::std::result::Result<
5829 ::std::option::Option<::std::string::String>,
5830 ::std::string::String,
5831 >,
5832 distance: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
5833 duration: ::std::result::Result<i64, ::std::string::String>,
5834 effective_fare_leg_index:
5835 ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
5836 end_time: ::std::result::Result<
5837 ::chrono::DateTime<::chrono::offset::Utc>,
5838 ::std::string::String,
5839 >,
5840 fare_transfer_index:
5841 ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
5842 from: ::std::result::Result<super::Place, ::std::string::String>,
5843 headsign: ::std::result::Result<
5844 ::std::option::Option<::std::string::String>,
5845 ::std::string::String,
5846 >,
5847 interline_with_previous_leg:
5848 ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
5849 intermediate_stops:
5850 ::std::result::Result<::std::vec::Vec<super::Place>, ::std::string::String>,
5851 leg_geometry: ::std::result::Result<super::EncodedPolyline, ::std::string::String>,
5852 looped_calendar_since: ::std::result::Result<
5853 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
5854 ::std::string::String,
5855 >,
5856 mode: ::std::result::Result<super::Mode, ::std::string::String>,
5857 real_time: ::std::result::Result<bool, ::std::string::String>,
5858 rental:
5859 ::std::result::Result<::std::option::Option<super::Rental>, ::std::string::String>,
5860 route_color: ::std::result::Result<
5861 ::std::option::Option<::std::string::String>,
5862 ::std::string::String,
5863 >,
5864 route_long_name: ::std::result::Result<
5865 ::std::option::Option<::std::string::String>,
5866 ::std::string::String,
5867 >,
5868 route_short_name: ::std::result::Result<
5869 ::std::option::Option<::std::string::String>,
5870 ::std::string::String,
5871 >,
5872 route_text_color: ::std::result::Result<
5873 ::std::option::Option<::std::string::String>,
5874 ::std::string::String,
5875 >,
5876 route_type: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
5877 scheduled: ::std::result::Result<bool, ::std::string::String>,
5878 scheduled_end_time: ::std::result::Result<
5879 ::chrono::DateTime<::chrono::offset::Utc>,
5880 ::std::string::String,
5881 >,
5882 scheduled_start_time: ::std::result::Result<
5883 ::chrono::DateTime<::chrono::offset::Utc>,
5884 ::std::string::String,
5885 >,
5886 source: ::std::result::Result<
5887 ::std::option::Option<::std::string::String>,
5888 ::std::string::String,
5889 >,
5890 start_time: ::std::result::Result<
5891 ::chrono::DateTime<::chrono::offset::Utc>,
5892 ::std::string::String,
5893 >,
5894 steps: ::std::result::Result<
5895 ::std::vec::Vec<super::StepInstruction>,
5896 ::std::string::String,
5897 >,
5898 to: ::std::result::Result<super::Place, ::std::string::String>,
5899 trip_id: ::std::result::Result<
5900 ::std::option::Option<::std::string::String>,
5901 ::std::string::String,
5902 >,
5903 trip_short_name: ::std::result::Result<
5904 ::std::option::Option<::std::string::String>,
5905 ::std::string::String,
5906 >,
5907 trip_to:
5908 ::std::result::Result<::std::option::Option<super::Place>, ::std::string::String>,
5909 }
5910
5911 impl ::std::default::Default for Leg {
5912 fn default() -> Self {
5913 Self {
5914 agency_id: Ok(Default::default()),
5915 agency_name: Ok(Default::default()),
5916 agency_url: Ok(Default::default()),
5917 alerts: Ok(Default::default()),
5918 cancelled: Ok(Default::default()),
5919 display_name: Ok(Default::default()),
5920 distance: Ok(Default::default()),
5921 duration: Err("no value supplied for duration".to_string()),
5922 effective_fare_leg_index: Ok(Default::default()),
5923 end_time: Err("no value supplied for end_time".to_string()),
5924 fare_transfer_index: Ok(Default::default()),
5925 from: Err("no value supplied for from".to_string()),
5926 headsign: Ok(Default::default()),
5927 interline_with_previous_leg: Ok(Default::default()),
5928 intermediate_stops: Ok(Default::default()),
5929 leg_geometry: Err("no value supplied for leg_geometry".to_string()),
5930 looped_calendar_since: Ok(Default::default()),
5931 mode: Err("no value supplied for mode".to_string()),
5932 real_time: Err("no value supplied for real_time".to_string()),
5933 rental: Ok(Default::default()),
5934 route_color: Ok(Default::default()),
5935 route_long_name: Ok(Default::default()),
5936 route_short_name: Ok(Default::default()),
5937 route_text_color: Ok(Default::default()),
5938 route_type: Ok(Default::default()),
5939 scheduled: Err("no value supplied for scheduled".to_string()),
5940 scheduled_end_time: Err("no value supplied for scheduled_end_time".to_string()),
5941 scheduled_start_time: Err(
5942 "no value supplied for scheduled_start_time".to_string()
5943 ),
5944 source: Ok(Default::default()),
5945 start_time: Err("no value supplied for start_time".to_string()),
5946 steps: Ok(Default::default()),
5947 to: Err("no value supplied for to".to_string()),
5948 trip_id: Ok(Default::default()),
5949 trip_short_name: Ok(Default::default()),
5950 trip_to: Ok(Default::default()),
5951 }
5952 }
5953 }
5954
5955 impl Leg {
5956 pub fn agency_id<T>(mut self, value: T) -> Self
5957 where
5958 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5959 T::Error: ::std::fmt::Display,
5960 {
5961 self.agency_id = value
5962 .try_into()
5963 .map_err(|e| format!("error converting supplied value for agency_id: {}", e));
5964 self
5965 }
5966 pub fn agency_name<T>(mut self, value: T) -> Self
5967 where
5968 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5969 T::Error: ::std::fmt::Display,
5970 {
5971 self.agency_name = value
5972 .try_into()
5973 .map_err(|e| format!("error converting supplied value for agency_name: {}", e));
5974 self
5975 }
5976 pub fn agency_url<T>(mut self, value: T) -> Self
5977 where
5978 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5979 T::Error: ::std::fmt::Display,
5980 {
5981 self.agency_url = value
5982 .try_into()
5983 .map_err(|e| format!("error converting supplied value for agency_url: {}", e));
5984 self
5985 }
5986 pub fn alerts<T>(mut self, value: T) -> Self
5987 where
5988 T: ::std::convert::TryInto<::std::vec::Vec<super::Alert>>,
5989 T::Error: ::std::fmt::Display,
5990 {
5991 self.alerts = value
5992 .try_into()
5993 .map_err(|e| format!("error converting supplied value for alerts: {}", e));
5994 self
5995 }
5996 pub fn cancelled<T>(mut self, value: T) -> Self
5997 where
5998 T: ::std::convert::TryInto<::std::option::Option<bool>>,
5999 T::Error: ::std::fmt::Display,
6000 {
6001 self.cancelled = value
6002 .try_into()
6003 .map_err(|e| format!("error converting supplied value for cancelled: {}", e));
6004 self
6005 }
6006 pub fn display_name<T>(mut self, value: T) -> Self
6007 where
6008 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6009 T::Error: ::std::fmt::Display,
6010 {
6011 self.display_name = value.try_into().map_err(|e| {
6012 format!("error converting supplied value for display_name: {}", e)
6013 });
6014 self
6015 }
6016 pub fn distance<T>(mut self, value: T) -> Self
6017 where
6018 T: ::std::convert::TryInto<::std::option::Option<f64>>,
6019 T::Error: ::std::fmt::Display,
6020 {
6021 self.distance = value
6022 .try_into()
6023 .map_err(|e| format!("error converting supplied value for distance: {}", e));
6024 self
6025 }
6026 pub fn duration<T>(mut self, value: T) -> Self
6027 where
6028 T: ::std::convert::TryInto<i64>,
6029 T::Error: ::std::fmt::Display,
6030 {
6031 self.duration = value
6032 .try_into()
6033 .map_err(|e| format!("error converting supplied value for duration: {}", e));
6034 self
6035 }
6036 pub fn effective_fare_leg_index<T>(mut self, value: T) -> Self
6037 where
6038 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6039 T::Error: ::std::fmt::Display,
6040 {
6041 self.effective_fare_leg_index = value.try_into().map_err(|e| {
6042 format!(
6043 "error converting supplied value for effective_fare_leg_index: {}",
6044 e
6045 )
6046 });
6047 self
6048 }
6049 pub fn end_time<T>(mut self, value: T) -> Self
6050 where
6051 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
6052 T::Error: ::std::fmt::Display,
6053 {
6054 self.end_time = value
6055 .try_into()
6056 .map_err(|e| format!("error converting supplied value for end_time: {}", e));
6057 self
6058 }
6059 pub fn fare_transfer_index<T>(mut self, value: T) -> Self
6060 where
6061 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6062 T::Error: ::std::fmt::Display,
6063 {
6064 self.fare_transfer_index = value.try_into().map_err(|e| {
6065 format!(
6066 "error converting supplied value for fare_transfer_index: {}",
6067 e
6068 )
6069 });
6070 self
6071 }
6072 pub fn from<T>(mut self, value: T) -> Self
6073 where
6074 T: ::std::convert::TryInto<super::Place>,
6075 T::Error: ::std::fmt::Display,
6076 {
6077 self.from = value
6078 .try_into()
6079 .map_err(|e| format!("error converting supplied value for from: {}", e));
6080 self
6081 }
6082 pub fn headsign<T>(mut self, value: T) -> Self
6083 where
6084 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6085 T::Error: ::std::fmt::Display,
6086 {
6087 self.headsign = value
6088 .try_into()
6089 .map_err(|e| format!("error converting supplied value for headsign: {}", e));
6090 self
6091 }
6092 pub fn interline_with_previous_leg<T>(mut self, value: T) -> Self
6093 where
6094 T: ::std::convert::TryInto<::std::option::Option<bool>>,
6095 T::Error: ::std::fmt::Display,
6096 {
6097 self.interline_with_previous_leg = value.try_into().map_err(|e| {
6098 format!(
6099 "error converting supplied value for interline_with_previous_leg: {}",
6100 e
6101 )
6102 });
6103 self
6104 }
6105 pub fn intermediate_stops<T>(mut self, value: T) -> Self
6106 where
6107 T: ::std::convert::TryInto<::std::vec::Vec<super::Place>>,
6108 T::Error: ::std::fmt::Display,
6109 {
6110 self.intermediate_stops = value.try_into().map_err(|e| {
6111 format!(
6112 "error converting supplied value for intermediate_stops: {}",
6113 e
6114 )
6115 });
6116 self
6117 }
6118 pub fn leg_geometry<T>(mut self, value: T) -> Self
6119 where
6120 T: ::std::convert::TryInto<super::EncodedPolyline>,
6121 T::Error: ::std::fmt::Display,
6122 {
6123 self.leg_geometry = value.try_into().map_err(|e| {
6124 format!("error converting supplied value for leg_geometry: {}", e)
6125 });
6126 self
6127 }
6128 pub fn looped_calendar_since<T>(mut self, value: T) -> Self
6129 where
6130 T: ::std::convert::TryInto<
6131 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6132 >,
6133 T::Error: ::std::fmt::Display,
6134 {
6135 self.looped_calendar_since = value.try_into().map_err(|e| {
6136 format!(
6137 "error converting supplied value for looped_calendar_since: {}",
6138 e
6139 )
6140 });
6141 self
6142 }
6143 pub fn mode<T>(mut self, value: T) -> Self
6144 where
6145 T: ::std::convert::TryInto<super::Mode>,
6146 T::Error: ::std::fmt::Display,
6147 {
6148 self.mode = value
6149 .try_into()
6150 .map_err(|e| format!("error converting supplied value for mode: {}", e));
6151 self
6152 }
6153 pub fn real_time<T>(mut self, value: T) -> Self
6154 where
6155 T: ::std::convert::TryInto<bool>,
6156 T::Error: ::std::fmt::Display,
6157 {
6158 self.real_time = value
6159 .try_into()
6160 .map_err(|e| format!("error converting supplied value for real_time: {}", e));
6161 self
6162 }
6163 pub fn rental<T>(mut self, value: T) -> Self
6164 where
6165 T: ::std::convert::TryInto<::std::option::Option<super::Rental>>,
6166 T::Error: ::std::fmt::Display,
6167 {
6168 self.rental = value
6169 .try_into()
6170 .map_err(|e| format!("error converting supplied value for rental: {}", e));
6171 self
6172 }
6173 pub fn route_color<T>(mut self, value: T) -> Self
6174 where
6175 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6176 T::Error: ::std::fmt::Display,
6177 {
6178 self.route_color = value
6179 .try_into()
6180 .map_err(|e| format!("error converting supplied value for route_color: {}", e));
6181 self
6182 }
6183 pub fn route_long_name<T>(mut self, value: T) -> Self
6184 where
6185 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6186 T::Error: ::std::fmt::Display,
6187 {
6188 self.route_long_name = value.try_into().map_err(|e| {
6189 format!("error converting supplied value for route_long_name: {}", e)
6190 });
6191 self
6192 }
6193 pub fn route_short_name<T>(mut self, value: T) -> Self
6194 where
6195 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6196 T::Error: ::std::fmt::Display,
6197 {
6198 self.route_short_name = value.try_into().map_err(|e| {
6199 format!(
6200 "error converting supplied value for route_short_name: {}",
6201 e
6202 )
6203 });
6204 self
6205 }
6206 pub fn route_text_color<T>(mut self, value: T) -> Self
6207 where
6208 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6209 T::Error: ::std::fmt::Display,
6210 {
6211 self.route_text_color = value.try_into().map_err(|e| {
6212 format!(
6213 "error converting supplied value for route_text_color: {}",
6214 e
6215 )
6216 });
6217 self
6218 }
6219 pub fn route_type<T>(mut self, value: T) -> Self
6220 where
6221 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6222 T::Error: ::std::fmt::Display,
6223 {
6224 self.route_type = value
6225 .try_into()
6226 .map_err(|e| format!("error converting supplied value for route_type: {}", e));
6227 self
6228 }
6229 pub fn scheduled<T>(mut self, value: T) -> Self
6230 where
6231 T: ::std::convert::TryInto<bool>,
6232 T::Error: ::std::fmt::Display,
6233 {
6234 self.scheduled = value
6235 .try_into()
6236 .map_err(|e| format!("error converting supplied value for scheduled: {}", e));
6237 self
6238 }
6239 pub fn scheduled_end_time<T>(mut self, value: T) -> Self
6240 where
6241 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
6242 T::Error: ::std::fmt::Display,
6243 {
6244 self.scheduled_end_time = value.try_into().map_err(|e| {
6245 format!(
6246 "error converting supplied value for scheduled_end_time: {}",
6247 e
6248 )
6249 });
6250 self
6251 }
6252 pub fn scheduled_start_time<T>(mut self, value: T) -> Self
6253 where
6254 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
6255 T::Error: ::std::fmt::Display,
6256 {
6257 self.scheduled_start_time = value.try_into().map_err(|e| {
6258 format!(
6259 "error converting supplied value for scheduled_start_time: {}",
6260 e
6261 )
6262 });
6263 self
6264 }
6265 pub fn source<T>(mut self, value: T) -> Self
6266 where
6267 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6268 T::Error: ::std::fmt::Display,
6269 {
6270 self.source = value
6271 .try_into()
6272 .map_err(|e| format!("error converting supplied value for source: {}", e));
6273 self
6274 }
6275 pub fn start_time<T>(mut self, value: T) -> Self
6276 where
6277 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
6278 T::Error: ::std::fmt::Display,
6279 {
6280 self.start_time = value
6281 .try_into()
6282 .map_err(|e| format!("error converting supplied value for start_time: {}", e));
6283 self
6284 }
6285 pub fn steps<T>(mut self, value: T) -> Self
6286 where
6287 T: ::std::convert::TryInto<::std::vec::Vec<super::StepInstruction>>,
6288 T::Error: ::std::fmt::Display,
6289 {
6290 self.steps = value
6291 .try_into()
6292 .map_err(|e| format!("error converting supplied value for steps: {}", e));
6293 self
6294 }
6295 pub fn to<T>(mut self, value: T) -> Self
6296 where
6297 T: ::std::convert::TryInto<super::Place>,
6298 T::Error: ::std::fmt::Display,
6299 {
6300 self.to = value
6301 .try_into()
6302 .map_err(|e| format!("error converting supplied value for to: {}", e));
6303 self
6304 }
6305 pub fn trip_id<T>(mut self, value: T) -> Self
6306 where
6307 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6308 T::Error: ::std::fmt::Display,
6309 {
6310 self.trip_id = value
6311 .try_into()
6312 .map_err(|e| format!("error converting supplied value for trip_id: {}", e));
6313 self
6314 }
6315 pub fn trip_short_name<T>(mut self, value: T) -> Self
6316 where
6317 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6318 T::Error: ::std::fmt::Display,
6319 {
6320 self.trip_short_name = value.try_into().map_err(|e| {
6321 format!("error converting supplied value for trip_short_name: {}", e)
6322 });
6323 self
6324 }
6325 pub fn trip_to<T>(mut self, value: T) -> Self
6326 where
6327 T: ::std::convert::TryInto<::std::option::Option<super::Place>>,
6328 T::Error: ::std::fmt::Display,
6329 {
6330 self.trip_to = value
6331 .try_into()
6332 .map_err(|e| format!("error converting supplied value for trip_to: {}", e));
6333 self
6334 }
6335 }
6336
6337 impl ::std::convert::TryFrom<Leg> for super::Leg {
6338 type Error = super::error::ConversionError;
6339 fn try_from(value: Leg) -> ::std::result::Result<Self, super::error::ConversionError> {
6340 Ok(Self {
6341 agency_id: value.agency_id?,
6342 agency_name: value.agency_name?,
6343 agency_url: value.agency_url?,
6344 alerts: value.alerts?,
6345 cancelled: value.cancelled?,
6346 display_name: value.display_name?,
6347 distance: value.distance?,
6348 duration: value.duration?,
6349 effective_fare_leg_index: value.effective_fare_leg_index?,
6350 end_time: value.end_time?,
6351 fare_transfer_index: value.fare_transfer_index?,
6352 from: value.from?,
6353 headsign: value.headsign?,
6354 interline_with_previous_leg: value.interline_with_previous_leg?,
6355 intermediate_stops: value.intermediate_stops?,
6356 leg_geometry: value.leg_geometry?,
6357 looped_calendar_since: value.looped_calendar_since?,
6358 mode: value.mode?,
6359 real_time: value.real_time?,
6360 rental: value.rental?,
6361 route_color: value.route_color?,
6362 route_long_name: value.route_long_name?,
6363 route_short_name: value.route_short_name?,
6364 route_text_color: value.route_text_color?,
6365 route_type: value.route_type?,
6366 scheduled: value.scheduled?,
6367 scheduled_end_time: value.scheduled_end_time?,
6368 scheduled_start_time: value.scheduled_start_time?,
6369 source: value.source?,
6370 start_time: value.start_time?,
6371 steps: value.steps?,
6372 to: value.to?,
6373 trip_id: value.trip_id?,
6374 trip_short_name: value.trip_short_name?,
6375 trip_to: value.trip_to?,
6376 })
6377 }
6378 }
6379
6380 impl ::std::convert::From<super::Leg> for Leg {
6381 fn from(value: super::Leg) -> Self {
6382 Self {
6383 agency_id: Ok(value.agency_id),
6384 agency_name: Ok(value.agency_name),
6385 agency_url: Ok(value.agency_url),
6386 alerts: Ok(value.alerts),
6387 cancelled: Ok(value.cancelled),
6388 display_name: Ok(value.display_name),
6389 distance: Ok(value.distance),
6390 duration: Ok(value.duration),
6391 effective_fare_leg_index: Ok(value.effective_fare_leg_index),
6392 end_time: Ok(value.end_time),
6393 fare_transfer_index: Ok(value.fare_transfer_index),
6394 from: Ok(value.from),
6395 headsign: Ok(value.headsign),
6396 interline_with_previous_leg: Ok(value.interline_with_previous_leg),
6397 intermediate_stops: Ok(value.intermediate_stops),
6398 leg_geometry: Ok(value.leg_geometry),
6399 looped_calendar_since: Ok(value.looped_calendar_since),
6400 mode: Ok(value.mode),
6401 real_time: Ok(value.real_time),
6402 rental: Ok(value.rental),
6403 route_color: Ok(value.route_color),
6404 route_long_name: Ok(value.route_long_name),
6405 route_short_name: Ok(value.route_short_name),
6406 route_text_color: Ok(value.route_text_color),
6407 route_type: Ok(value.route_type),
6408 scheduled: Ok(value.scheduled),
6409 scheduled_end_time: Ok(value.scheduled_end_time),
6410 scheduled_start_time: Ok(value.scheduled_start_time),
6411 source: Ok(value.source),
6412 start_time: Ok(value.start_time),
6413 steps: Ok(value.steps),
6414 to: Ok(value.to),
6415 trip_id: Ok(value.trip_id),
6416 trip_short_name: Ok(value.trip_short_name),
6417 trip_to: Ok(value.trip_to),
6418 }
6419 }
6420 }
6421
6422 #[derive(Clone, Debug)]
6423 pub struct Match {
6424 areas: ::std::result::Result<::std::vec::Vec<super::Area>, ::std::string::String>,
6425 house_number: ::std::result::Result<
6426 ::std::option::Option<::std::string::String>,
6427 ::std::string::String,
6428 >,
6429 id: ::std::result::Result<::std::string::String, ::std::string::String>,
6430 lat: ::std::result::Result<f64, ::std::string::String>,
6431 level: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
6432 lon: ::std::result::Result<f64, ::std::string::String>,
6433 name: ::std::result::Result<::std::string::String, ::std::string::String>,
6434 score: ::std::result::Result<f64, ::std::string::String>,
6435 street: ::std::result::Result<
6436 ::std::option::Option<::std::string::String>,
6437 ::std::string::String,
6438 >,
6439 tokens: ::std::result::Result<::std::vec::Vec<super::Token>, ::std::string::String>,
6440 type_: ::std::result::Result<super::LocationType, ::std::string::String>,
6441 tz: ::std::result::Result<
6442 ::std::option::Option<::std::string::String>,
6443 ::std::string::String,
6444 >,
6445 zip: ::std::result::Result<
6446 ::std::option::Option<::std::string::String>,
6447 ::std::string::String,
6448 >,
6449 }
6450
6451 impl ::std::default::Default for Match {
6452 fn default() -> Self {
6453 Self {
6454 areas: Err("no value supplied for areas".to_string()),
6455 house_number: Ok(Default::default()),
6456 id: Err("no value supplied for id".to_string()),
6457 lat: Err("no value supplied for lat".to_string()),
6458 level: Ok(Default::default()),
6459 lon: Err("no value supplied for lon".to_string()),
6460 name: Err("no value supplied for name".to_string()),
6461 score: Err("no value supplied for score".to_string()),
6462 street: Ok(Default::default()),
6463 tokens: Err("no value supplied for tokens".to_string()),
6464 type_: Err("no value supplied for type_".to_string()),
6465 tz: Ok(Default::default()),
6466 zip: Ok(Default::default()),
6467 }
6468 }
6469 }
6470
6471 impl Match {
6472 pub fn areas<T>(mut self, value: T) -> Self
6473 where
6474 T: ::std::convert::TryInto<::std::vec::Vec<super::Area>>,
6475 T::Error: ::std::fmt::Display,
6476 {
6477 self.areas = value
6478 .try_into()
6479 .map_err(|e| format!("error converting supplied value for areas: {}", e));
6480 self
6481 }
6482 pub fn house_number<T>(mut self, value: T) -> Self
6483 where
6484 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6485 T::Error: ::std::fmt::Display,
6486 {
6487 self.house_number = value.try_into().map_err(|e| {
6488 format!("error converting supplied value for house_number: {}", e)
6489 });
6490 self
6491 }
6492 pub fn id<T>(mut self, value: T) -> Self
6493 where
6494 T: ::std::convert::TryInto<::std::string::String>,
6495 T::Error: ::std::fmt::Display,
6496 {
6497 self.id = value
6498 .try_into()
6499 .map_err(|e| format!("error converting supplied value for id: {}", e));
6500 self
6501 }
6502 pub fn lat<T>(mut self, value: T) -> Self
6503 where
6504 T: ::std::convert::TryInto<f64>,
6505 T::Error: ::std::fmt::Display,
6506 {
6507 self.lat = value
6508 .try_into()
6509 .map_err(|e| format!("error converting supplied value for lat: {}", e));
6510 self
6511 }
6512 pub fn level<T>(mut self, value: T) -> Self
6513 where
6514 T: ::std::convert::TryInto<::std::option::Option<f64>>,
6515 T::Error: ::std::fmt::Display,
6516 {
6517 self.level = value
6518 .try_into()
6519 .map_err(|e| format!("error converting supplied value for level: {}", e));
6520 self
6521 }
6522 pub fn lon<T>(mut self, value: T) -> Self
6523 where
6524 T: ::std::convert::TryInto<f64>,
6525 T::Error: ::std::fmt::Display,
6526 {
6527 self.lon = value
6528 .try_into()
6529 .map_err(|e| format!("error converting supplied value for lon: {}", e));
6530 self
6531 }
6532 pub fn name<T>(mut self, value: T) -> Self
6533 where
6534 T: ::std::convert::TryInto<::std::string::String>,
6535 T::Error: ::std::fmt::Display,
6536 {
6537 self.name = value
6538 .try_into()
6539 .map_err(|e| format!("error converting supplied value for name: {}", e));
6540 self
6541 }
6542 pub fn score<T>(mut self, value: T) -> Self
6543 where
6544 T: ::std::convert::TryInto<f64>,
6545 T::Error: ::std::fmt::Display,
6546 {
6547 self.score = value
6548 .try_into()
6549 .map_err(|e| format!("error converting supplied value for score: {}", e));
6550 self
6551 }
6552 pub fn street<T>(mut self, value: T) -> Self
6553 where
6554 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6555 T::Error: ::std::fmt::Display,
6556 {
6557 self.street = value
6558 .try_into()
6559 .map_err(|e| format!("error converting supplied value for street: {}", e));
6560 self
6561 }
6562 pub fn tokens<T>(mut self, value: T) -> Self
6563 where
6564 T: ::std::convert::TryInto<::std::vec::Vec<super::Token>>,
6565 T::Error: ::std::fmt::Display,
6566 {
6567 self.tokens = value
6568 .try_into()
6569 .map_err(|e| format!("error converting supplied value for tokens: {}", e));
6570 self
6571 }
6572 pub fn type_<T>(mut self, value: T) -> Self
6573 where
6574 T: ::std::convert::TryInto<super::LocationType>,
6575 T::Error: ::std::fmt::Display,
6576 {
6577 self.type_ = value
6578 .try_into()
6579 .map_err(|e| format!("error converting supplied value for type_: {}", e));
6580 self
6581 }
6582 pub fn tz<T>(mut self, value: T) -> Self
6583 where
6584 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6585 T::Error: ::std::fmt::Display,
6586 {
6587 self.tz = value
6588 .try_into()
6589 .map_err(|e| format!("error converting supplied value for tz: {}", e));
6590 self
6591 }
6592 pub fn zip<T>(mut self, value: T) -> Self
6593 where
6594 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6595 T::Error: ::std::fmt::Display,
6596 {
6597 self.zip = value
6598 .try_into()
6599 .map_err(|e| format!("error converting supplied value for zip: {}", e));
6600 self
6601 }
6602 }
6603
6604 impl ::std::convert::TryFrom<Match> for super::Match {
6605 type Error = super::error::ConversionError;
6606 fn try_from(
6607 value: Match,
6608 ) -> ::std::result::Result<Self, super::error::ConversionError> {
6609 Ok(Self {
6610 areas: value.areas?,
6611 house_number: value.house_number?,
6612 id: value.id?,
6613 lat: value.lat?,
6614 level: value.level?,
6615 lon: value.lon?,
6616 name: value.name?,
6617 score: value.score?,
6618 street: value.street?,
6619 tokens: value.tokens?,
6620 type_: value.type_?,
6621 tz: value.tz?,
6622 zip: value.zip?,
6623 })
6624 }
6625 }
6626
6627 impl ::std::convert::From<super::Match> for Match {
6628 fn from(value: super::Match) -> Self {
6629 Self {
6630 areas: Ok(value.areas),
6631 house_number: Ok(value.house_number),
6632 id: Ok(value.id),
6633 lat: Ok(value.lat),
6634 level: Ok(value.level),
6635 lon: Ok(value.lon),
6636 name: Ok(value.name),
6637 score: Ok(value.score),
6638 street: Ok(value.street),
6639 tokens: Ok(value.tokens),
6640 type_: Ok(value.type_),
6641 tz: Ok(value.tz),
6642 zip: Ok(value.zip),
6643 }
6644 }
6645 }
6646
6647 #[derive(Clone, Debug)]
6648 pub struct Place {
6649 alerts: ::std::result::Result<::std::vec::Vec<super::Alert>, ::std::string::String>,
6650 arrival: ::std::result::Result<
6651 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6652 ::std::string::String,
6653 >,
6654 cancelled: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
6655 departure: ::std::result::Result<
6656 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6657 ::std::string::String,
6658 >,
6659 description: ::std::result::Result<
6660 ::std::option::Option<::std::string::String>,
6661 ::std::string::String,
6662 >,
6663 dropoff_type: ::std::result::Result<
6664 ::std::option::Option<super::PickupDropoffType>,
6665 ::std::string::String,
6666 >,
6667 flex: ::std::result::Result<
6668 ::std::option::Option<::std::string::String>,
6669 ::std::string::String,
6670 >,
6671 flex_end_pickup_drop_off_window: ::std::result::Result<
6672 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6673 ::std::string::String,
6674 >,
6675 flex_id: ::std::result::Result<
6676 ::std::option::Option<::std::string::String>,
6677 ::std::string::String,
6678 >,
6679 flex_start_pickup_drop_off_window: ::std::result::Result<
6680 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6681 ::std::string::String,
6682 >,
6683 lat: ::std::result::Result<f64, ::std::string::String>,
6684 level: ::std::result::Result<f64, ::std::string::String>,
6685 lon: ::std::result::Result<f64, ::std::string::String>,
6686 name: ::std::result::Result<::std::string::String, ::std::string::String>,
6687 pickup_type: ::std::result::Result<
6688 ::std::option::Option<super::PickupDropoffType>,
6689 ::std::string::String,
6690 >,
6691 scheduled_arrival: ::std::result::Result<
6692 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6693 ::std::string::String,
6694 >,
6695 scheduled_departure: ::std::result::Result<
6696 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6697 ::std::string::String,
6698 >,
6699 scheduled_track: ::std::result::Result<
6700 ::std::option::Option<::std::string::String>,
6701 ::std::string::String,
6702 >,
6703 stop_id: ::std::result::Result<
6704 ::std::option::Option<::std::string::String>,
6705 ::std::string::String,
6706 >,
6707 track: ::std::result::Result<
6708 ::std::option::Option<::std::string::String>,
6709 ::std::string::String,
6710 >,
6711 tz: ::std::result::Result<
6712 ::std::option::Option<::std::string::String>,
6713 ::std::string::String,
6714 >,
6715 vertex_type: ::std::result::Result<
6716 ::std::option::Option<super::VertexType>,
6717 ::std::string::String,
6718 >,
6719 }
6720
6721 impl ::std::default::Default for Place {
6722 fn default() -> Self {
6723 Self {
6724 alerts: Ok(Default::default()),
6725 arrival: Ok(Default::default()),
6726 cancelled: Ok(Default::default()),
6727 departure: Ok(Default::default()),
6728 description: Ok(Default::default()),
6729 dropoff_type: Ok(Default::default()),
6730 flex: Ok(Default::default()),
6731 flex_end_pickup_drop_off_window: Ok(Default::default()),
6732 flex_id: Ok(Default::default()),
6733 flex_start_pickup_drop_off_window: Ok(Default::default()),
6734 lat: Err("no value supplied for lat".to_string()),
6735 level: Err("no value supplied for level".to_string()),
6736 lon: Err("no value supplied for lon".to_string()),
6737 name: Err("no value supplied for name".to_string()),
6738 pickup_type: Ok(Default::default()),
6739 scheduled_arrival: Ok(Default::default()),
6740 scheduled_departure: Ok(Default::default()),
6741 scheduled_track: Ok(Default::default()),
6742 stop_id: Ok(Default::default()),
6743 track: Ok(Default::default()),
6744 tz: Ok(Default::default()),
6745 vertex_type: Ok(Default::default()),
6746 }
6747 }
6748 }
6749
6750 impl Place {
6751 pub fn alerts<T>(mut self, value: T) -> Self
6752 where
6753 T: ::std::convert::TryInto<::std::vec::Vec<super::Alert>>,
6754 T::Error: ::std::fmt::Display,
6755 {
6756 self.alerts = value
6757 .try_into()
6758 .map_err(|e| format!("error converting supplied value for alerts: {}", e));
6759 self
6760 }
6761 pub fn arrival<T>(mut self, value: T) -> Self
6762 where
6763 T: ::std::convert::TryInto<
6764 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6765 >,
6766 T::Error: ::std::fmt::Display,
6767 {
6768 self.arrival = value
6769 .try_into()
6770 .map_err(|e| format!("error converting supplied value for arrival: {}", e));
6771 self
6772 }
6773 pub fn cancelled<T>(mut self, value: T) -> Self
6774 where
6775 T: ::std::convert::TryInto<::std::option::Option<bool>>,
6776 T::Error: ::std::fmt::Display,
6777 {
6778 self.cancelled = value
6779 .try_into()
6780 .map_err(|e| format!("error converting supplied value for cancelled: {}", e));
6781 self
6782 }
6783 pub fn departure<T>(mut self, value: T) -> Self
6784 where
6785 T: ::std::convert::TryInto<
6786 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6787 >,
6788 T::Error: ::std::fmt::Display,
6789 {
6790 self.departure = value
6791 .try_into()
6792 .map_err(|e| format!("error converting supplied value for departure: {}", e));
6793 self
6794 }
6795 pub fn description<T>(mut self, value: T) -> Self
6796 where
6797 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6798 T::Error: ::std::fmt::Display,
6799 {
6800 self.description = value
6801 .try_into()
6802 .map_err(|e| format!("error converting supplied value for description: {}", e));
6803 self
6804 }
6805 pub fn dropoff_type<T>(mut self, value: T) -> Self
6806 where
6807 T: ::std::convert::TryInto<::std::option::Option<super::PickupDropoffType>>,
6808 T::Error: ::std::fmt::Display,
6809 {
6810 self.dropoff_type = value.try_into().map_err(|e| {
6811 format!("error converting supplied value for dropoff_type: {}", e)
6812 });
6813 self
6814 }
6815 pub fn flex<T>(mut self, value: T) -> Self
6816 where
6817 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6818 T::Error: ::std::fmt::Display,
6819 {
6820 self.flex = value
6821 .try_into()
6822 .map_err(|e| format!("error converting supplied value for flex: {}", e));
6823 self
6824 }
6825 pub fn flex_end_pickup_drop_off_window<T>(mut self, value: T) -> Self
6826 where
6827 T: ::std::convert::TryInto<
6828 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6829 >,
6830 T::Error: ::std::fmt::Display,
6831 {
6832 self.flex_end_pickup_drop_off_window = value.try_into().map_err(|e| {
6833 format!(
6834 "error converting supplied value for flex_end_pickup_drop_off_window: {}",
6835 e
6836 )
6837 });
6838 self
6839 }
6840 pub fn flex_id<T>(mut self, value: T) -> Self
6841 where
6842 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6843 T::Error: ::std::fmt::Display,
6844 {
6845 self.flex_id = value
6846 .try_into()
6847 .map_err(|e| format!("error converting supplied value for flex_id: {}", e));
6848 self
6849 }
6850 pub fn flex_start_pickup_drop_off_window<T>(mut self, value: T) -> Self
6851 where
6852 T: ::std::convert::TryInto<
6853 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6854 >,
6855 T::Error: ::std::fmt::Display,
6856 {
6857 self.flex_start_pickup_drop_off_window = value.try_into().map_err(|e| {
6858 format!(
6859 "error converting supplied value for flex_start_pickup_drop_off_window: {}",
6860 e
6861 )
6862 });
6863 self
6864 }
6865 pub fn lat<T>(mut self, value: T) -> Self
6866 where
6867 T: ::std::convert::TryInto<f64>,
6868 T::Error: ::std::fmt::Display,
6869 {
6870 self.lat = value
6871 .try_into()
6872 .map_err(|e| format!("error converting supplied value for lat: {}", e));
6873 self
6874 }
6875 pub fn level<T>(mut self, value: T) -> Self
6876 where
6877 T: ::std::convert::TryInto<f64>,
6878 T::Error: ::std::fmt::Display,
6879 {
6880 self.level = value
6881 .try_into()
6882 .map_err(|e| format!("error converting supplied value for level: {}", e));
6883 self
6884 }
6885 pub fn lon<T>(mut self, value: T) -> Self
6886 where
6887 T: ::std::convert::TryInto<f64>,
6888 T::Error: ::std::fmt::Display,
6889 {
6890 self.lon = value
6891 .try_into()
6892 .map_err(|e| format!("error converting supplied value for lon: {}", e));
6893 self
6894 }
6895 pub fn name<T>(mut self, value: T) -> Self
6896 where
6897 T: ::std::convert::TryInto<::std::string::String>,
6898 T::Error: ::std::fmt::Display,
6899 {
6900 self.name = value
6901 .try_into()
6902 .map_err(|e| format!("error converting supplied value for name: {}", e));
6903 self
6904 }
6905 pub fn pickup_type<T>(mut self, value: T) -> Self
6906 where
6907 T: ::std::convert::TryInto<::std::option::Option<super::PickupDropoffType>>,
6908 T::Error: ::std::fmt::Display,
6909 {
6910 self.pickup_type = value
6911 .try_into()
6912 .map_err(|e| format!("error converting supplied value for pickup_type: {}", e));
6913 self
6914 }
6915 pub fn scheduled_arrival<T>(mut self, value: T) -> Self
6916 where
6917 T: ::std::convert::TryInto<
6918 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6919 >,
6920 T::Error: ::std::fmt::Display,
6921 {
6922 self.scheduled_arrival = value.try_into().map_err(|e| {
6923 format!(
6924 "error converting supplied value for scheduled_arrival: {}",
6925 e
6926 )
6927 });
6928 self
6929 }
6930 pub fn scheduled_departure<T>(mut self, value: T) -> Self
6931 where
6932 T: ::std::convert::TryInto<
6933 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
6934 >,
6935 T::Error: ::std::fmt::Display,
6936 {
6937 self.scheduled_departure = value.try_into().map_err(|e| {
6938 format!(
6939 "error converting supplied value for scheduled_departure: {}",
6940 e
6941 )
6942 });
6943 self
6944 }
6945 pub fn scheduled_track<T>(mut self, value: T) -> Self
6946 where
6947 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6948 T::Error: ::std::fmt::Display,
6949 {
6950 self.scheduled_track = value.try_into().map_err(|e| {
6951 format!("error converting supplied value for scheduled_track: {}", e)
6952 });
6953 self
6954 }
6955 pub fn stop_id<T>(mut self, value: T) -> Self
6956 where
6957 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6958 T::Error: ::std::fmt::Display,
6959 {
6960 self.stop_id = value
6961 .try_into()
6962 .map_err(|e| format!("error converting supplied value for stop_id: {}", e));
6963 self
6964 }
6965 pub fn track<T>(mut self, value: T) -> Self
6966 where
6967 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6968 T::Error: ::std::fmt::Display,
6969 {
6970 self.track = value
6971 .try_into()
6972 .map_err(|e| format!("error converting supplied value for track: {}", e));
6973 self
6974 }
6975 pub fn tz<T>(mut self, value: T) -> Self
6976 where
6977 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6978 T::Error: ::std::fmt::Display,
6979 {
6980 self.tz = value
6981 .try_into()
6982 .map_err(|e| format!("error converting supplied value for tz: {}", e));
6983 self
6984 }
6985 pub fn vertex_type<T>(mut self, value: T) -> Self
6986 where
6987 T: ::std::convert::TryInto<::std::option::Option<super::VertexType>>,
6988 T::Error: ::std::fmt::Display,
6989 {
6990 self.vertex_type = value
6991 .try_into()
6992 .map_err(|e| format!("error converting supplied value for vertex_type: {}", e));
6993 self
6994 }
6995 }
6996
6997 impl ::std::convert::TryFrom<Place> for super::Place {
6998 type Error = super::error::ConversionError;
6999 fn try_from(
7000 value: Place,
7001 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7002 Ok(Self {
7003 alerts: value.alerts?,
7004 arrival: value.arrival?,
7005 cancelled: value.cancelled?,
7006 departure: value.departure?,
7007 description: value.description?,
7008 dropoff_type: value.dropoff_type?,
7009 flex: value.flex?,
7010 flex_end_pickup_drop_off_window: value.flex_end_pickup_drop_off_window?,
7011 flex_id: value.flex_id?,
7012 flex_start_pickup_drop_off_window: value.flex_start_pickup_drop_off_window?,
7013 lat: value.lat?,
7014 level: value.level?,
7015 lon: value.lon?,
7016 name: value.name?,
7017 pickup_type: value.pickup_type?,
7018 scheduled_arrival: value.scheduled_arrival?,
7019 scheduled_departure: value.scheduled_departure?,
7020 scheduled_track: value.scheduled_track?,
7021 stop_id: value.stop_id?,
7022 track: value.track?,
7023 tz: value.tz?,
7024 vertex_type: value.vertex_type?,
7025 })
7026 }
7027 }
7028
7029 impl ::std::convert::From<super::Place> for Place {
7030 fn from(value: super::Place) -> Self {
7031 Self {
7032 alerts: Ok(value.alerts),
7033 arrival: Ok(value.arrival),
7034 cancelled: Ok(value.cancelled),
7035 departure: Ok(value.departure),
7036 description: Ok(value.description),
7037 dropoff_type: Ok(value.dropoff_type),
7038 flex: Ok(value.flex),
7039 flex_end_pickup_drop_off_window: Ok(value.flex_end_pickup_drop_off_window),
7040 flex_id: Ok(value.flex_id),
7041 flex_start_pickup_drop_off_window: Ok(value.flex_start_pickup_drop_off_window),
7042 lat: Ok(value.lat),
7043 level: Ok(value.level),
7044 lon: Ok(value.lon),
7045 name: Ok(value.name),
7046 pickup_type: Ok(value.pickup_type),
7047 scheduled_arrival: Ok(value.scheduled_arrival),
7048 scheduled_departure: Ok(value.scheduled_departure),
7049 scheduled_track: Ok(value.scheduled_track),
7050 stop_id: Ok(value.stop_id),
7051 track: Ok(value.track),
7052 tz: Ok(value.tz),
7053 vertex_type: Ok(value.vertex_type),
7054 }
7055 }
7056 }
7057
7058 #[derive(Clone, Debug)]
7059 pub struct PlanResponse {
7060 debug_output: ::std::result::Result<
7061 ::std::collections::HashMap<::std::string::String, i64>,
7062 ::std::string::String,
7063 >,
7064 direct: ::std::result::Result<::std::vec::Vec<super::Itinerary>, ::std::string::String>,
7065 from: ::std::result::Result<super::Place, ::std::string::String>,
7066 itineraries:
7067 ::std::result::Result<::std::vec::Vec<super::Itinerary>, ::std::string::String>,
7068 next_page_cursor: ::std::result::Result<::std::string::String, ::std::string::String>,
7069 previous_page_cursor:
7070 ::std::result::Result<::std::string::String, ::std::string::String>,
7071 request_parameters: ::std::result::Result<
7072 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
7073 ::std::string::String,
7074 >,
7075 to: ::std::result::Result<super::Place, ::std::string::String>,
7076 }
7077
7078 impl ::std::default::Default for PlanResponse {
7079 fn default() -> Self {
7080 Self {
7081 debug_output: Err("no value supplied for debug_output".to_string()),
7082 direct: Err("no value supplied for direct".to_string()),
7083 from: Err("no value supplied for from".to_string()),
7084 itineraries: Err("no value supplied for itineraries".to_string()),
7085 next_page_cursor: Err("no value supplied for next_page_cursor".to_string()),
7086 previous_page_cursor: Err(
7087 "no value supplied for previous_page_cursor".to_string()
7088 ),
7089 request_parameters: Err("no value supplied for request_parameters".to_string()),
7090 to: Err("no value supplied for to".to_string()),
7091 }
7092 }
7093 }
7094
7095 impl PlanResponse {
7096 pub fn debug_output<T>(mut self, value: T) -> Self
7097 where
7098 T: ::std::convert::TryInto<::std::collections::HashMap<::std::string::String, i64>>,
7099 T::Error: ::std::fmt::Display,
7100 {
7101 self.debug_output = value.try_into().map_err(|e| {
7102 format!("error converting supplied value for debug_output: {}", e)
7103 });
7104 self
7105 }
7106 pub fn direct<T>(mut self, value: T) -> Self
7107 where
7108 T: ::std::convert::TryInto<::std::vec::Vec<super::Itinerary>>,
7109 T::Error: ::std::fmt::Display,
7110 {
7111 self.direct = value
7112 .try_into()
7113 .map_err(|e| format!("error converting supplied value for direct: {}", e));
7114 self
7115 }
7116 pub fn from<T>(mut self, value: T) -> Self
7117 where
7118 T: ::std::convert::TryInto<super::Place>,
7119 T::Error: ::std::fmt::Display,
7120 {
7121 self.from = value
7122 .try_into()
7123 .map_err(|e| format!("error converting supplied value for from: {}", e));
7124 self
7125 }
7126 pub fn itineraries<T>(mut self, value: T) -> Self
7127 where
7128 T: ::std::convert::TryInto<::std::vec::Vec<super::Itinerary>>,
7129 T::Error: ::std::fmt::Display,
7130 {
7131 self.itineraries = value
7132 .try_into()
7133 .map_err(|e| format!("error converting supplied value for itineraries: {}", e));
7134 self
7135 }
7136 pub fn next_page_cursor<T>(mut self, value: T) -> Self
7137 where
7138 T: ::std::convert::TryInto<::std::string::String>,
7139 T::Error: ::std::fmt::Display,
7140 {
7141 self.next_page_cursor = value.try_into().map_err(|e| {
7142 format!(
7143 "error converting supplied value for next_page_cursor: {}",
7144 e
7145 )
7146 });
7147 self
7148 }
7149 pub fn previous_page_cursor<T>(mut self, value: T) -> Self
7150 where
7151 T: ::std::convert::TryInto<::std::string::String>,
7152 T::Error: ::std::fmt::Display,
7153 {
7154 self.previous_page_cursor = value.try_into().map_err(|e| {
7155 format!(
7156 "error converting supplied value for previous_page_cursor: {}",
7157 e
7158 )
7159 });
7160 self
7161 }
7162 pub fn request_parameters<T>(mut self, value: T) -> Self
7163 where
7164 T: ::std::convert::TryInto<
7165 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
7166 >,
7167 T::Error: ::std::fmt::Display,
7168 {
7169 self.request_parameters = value.try_into().map_err(|e| {
7170 format!(
7171 "error converting supplied value for request_parameters: {}",
7172 e
7173 )
7174 });
7175 self
7176 }
7177 pub fn to<T>(mut self, value: T) -> Self
7178 where
7179 T: ::std::convert::TryInto<super::Place>,
7180 T::Error: ::std::fmt::Display,
7181 {
7182 self.to = value
7183 .try_into()
7184 .map_err(|e| format!("error converting supplied value for to: {}", e));
7185 self
7186 }
7187 }
7188
7189 impl ::std::convert::TryFrom<PlanResponse> for super::PlanResponse {
7190 type Error = super::error::ConversionError;
7191 fn try_from(
7192 value: PlanResponse,
7193 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7194 Ok(Self {
7195 debug_output: value.debug_output?,
7196 direct: value.direct?,
7197 from: value.from?,
7198 itineraries: value.itineraries?,
7199 next_page_cursor: value.next_page_cursor?,
7200 previous_page_cursor: value.previous_page_cursor?,
7201 request_parameters: value.request_parameters?,
7202 to: value.to?,
7203 })
7204 }
7205 }
7206
7207 impl ::std::convert::From<super::PlanResponse> for PlanResponse {
7208 fn from(value: super::PlanResponse) -> Self {
7209 Self {
7210 debug_output: Ok(value.debug_output),
7211 direct: Ok(value.direct),
7212 from: Ok(value.from),
7213 itineraries: Ok(value.itineraries),
7214 next_page_cursor: Ok(value.next_page_cursor),
7215 previous_page_cursor: Ok(value.previous_page_cursor),
7216 request_parameters: Ok(value.request_parameters),
7217 to: Ok(value.to),
7218 }
7219 }
7220 }
7221
7222 #[derive(Clone, Debug)]
7223 pub struct Reachable {
7224 all: ::std::result::Result<
7225 ::std::vec::Vec<super::ReachablePlace>,
7226 ::std::string::String,
7227 >,
7228 one: ::std::result::Result<::std::option::Option<super::Place>, ::std::string::String>,
7229 }
7230
7231 impl ::std::default::Default for Reachable {
7232 fn default() -> Self {
7233 Self {
7234 all: Ok(Default::default()),
7235 one: Ok(Default::default()),
7236 }
7237 }
7238 }
7239
7240 impl Reachable {
7241 pub fn all<T>(mut self, value: T) -> Self
7242 where
7243 T: ::std::convert::TryInto<::std::vec::Vec<super::ReachablePlace>>,
7244 T::Error: ::std::fmt::Display,
7245 {
7246 self.all = value
7247 .try_into()
7248 .map_err(|e| format!("error converting supplied value for all: {}", e));
7249 self
7250 }
7251 pub fn one<T>(mut self, value: T) -> Self
7252 where
7253 T: ::std::convert::TryInto<::std::option::Option<super::Place>>,
7254 T::Error: ::std::fmt::Display,
7255 {
7256 self.one = value
7257 .try_into()
7258 .map_err(|e| format!("error converting supplied value for one: {}", e));
7259 self
7260 }
7261 }
7262
7263 impl ::std::convert::TryFrom<Reachable> for super::Reachable {
7264 type Error = super::error::ConversionError;
7265 fn try_from(
7266 value: Reachable,
7267 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7268 Ok(Self {
7269 all: value.all?,
7270 one: value.one?,
7271 })
7272 }
7273 }
7274
7275 impl ::std::convert::From<super::Reachable> for Reachable {
7276 fn from(value: super::Reachable) -> Self {
7277 Self {
7278 all: Ok(value.all),
7279 one: Ok(value.one),
7280 }
7281 }
7282 }
7283
7284 #[derive(Clone, Debug)]
7285 pub struct ReachablePlace {
7286 duration: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
7287 k: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
7288 place:
7289 ::std::result::Result<::std::option::Option<super::Place>, ::std::string::String>,
7290 }
7291
7292 impl ::std::default::Default for ReachablePlace {
7293 fn default() -> Self {
7294 Self {
7295 duration: Ok(Default::default()),
7296 k: Ok(Default::default()),
7297 place: Ok(Default::default()),
7298 }
7299 }
7300 }
7301
7302 impl ReachablePlace {
7303 pub fn duration<T>(mut self, value: T) -> Self
7304 where
7305 T: ::std::convert::TryInto<::std::option::Option<i64>>,
7306 T::Error: ::std::fmt::Display,
7307 {
7308 self.duration = value
7309 .try_into()
7310 .map_err(|e| format!("error converting supplied value for duration: {}", e));
7311 self
7312 }
7313 pub fn k<T>(mut self, value: T) -> Self
7314 where
7315 T: ::std::convert::TryInto<::std::option::Option<i64>>,
7316 T::Error: ::std::fmt::Display,
7317 {
7318 self.k = value
7319 .try_into()
7320 .map_err(|e| format!("error converting supplied value for k: {}", e));
7321 self
7322 }
7323 pub fn place<T>(mut self, value: T) -> Self
7324 where
7325 T: ::std::convert::TryInto<::std::option::Option<super::Place>>,
7326 T::Error: ::std::fmt::Display,
7327 {
7328 self.place = value
7329 .try_into()
7330 .map_err(|e| format!("error converting supplied value for place: {}", e));
7331 self
7332 }
7333 }
7334
7335 impl ::std::convert::TryFrom<ReachablePlace> for super::ReachablePlace {
7336 type Error = super::error::ConversionError;
7337 fn try_from(
7338 value: ReachablePlace,
7339 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7340 Ok(Self {
7341 duration: value.duration?,
7342 k: value.k?,
7343 place: value.place?,
7344 })
7345 }
7346 }
7347
7348 impl ::std::convert::From<super::ReachablePlace> for ReachablePlace {
7349 fn from(value: super::ReachablePlace) -> Self {
7350 Self {
7351 duration: Ok(value.duration),
7352 k: Ok(value.k),
7353 place: Ok(value.place),
7354 }
7355 }
7356 }
7357
7358 #[derive(Clone, Debug)]
7359 pub struct Rental {
7360 form_factor: ::std::result::Result<
7361 ::std::option::Option<super::RentalFormFactor>,
7362 ::std::string::String,
7363 >,
7364 from_station_name: ::std::result::Result<
7365 ::std::option::Option<::std::string::String>,
7366 ::std::string::String,
7367 >,
7368 propulsion_type: ::std::result::Result<
7369 ::std::option::Option<super::RentalPropulsionType>,
7370 ::std::string::String,
7371 >,
7372 rental_uri_android: ::std::result::Result<
7373 ::std::option::Option<::std::string::String>,
7374 ::std::string::String,
7375 >,
7376 rental_uri_ios: ::std::result::Result<
7377 ::std::option::Option<::std::string::String>,
7378 ::std::string::String,
7379 >,
7380 rental_uri_web: ::std::result::Result<
7381 ::std::option::Option<::std::string::String>,
7382 ::std::string::String,
7383 >,
7384 return_constraint: ::std::result::Result<
7385 ::std::option::Option<super::RentalReturnConstraint>,
7386 ::std::string::String,
7387 >,
7388 station_name: ::std::result::Result<
7389 ::std::option::Option<::std::string::String>,
7390 ::std::string::String,
7391 >,
7392 system_id: ::std::result::Result<::std::string::String, ::std::string::String>,
7393 system_name: ::std::result::Result<
7394 ::std::option::Option<::std::string::String>,
7395 ::std::string::String,
7396 >,
7397 to_station_name: ::std::result::Result<
7398 ::std::option::Option<::std::string::String>,
7399 ::std::string::String,
7400 >,
7401 url: ::std::result::Result<
7402 ::std::option::Option<::std::string::String>,
7403 ::std::string::String,
7404 >,
7405 }
7406
7407 impl ::std::default::Default for Rental {
7408 fn default() -> Self {
7409 Self {
7410 form_factor: Ok(Default::default()),
7411 from_station_name: Ok(Default::default()),
7412 propulsion_type: Ok(Default::default()),
7413 rental_uri_android: Ok(Default::default()),
7414 rental_uri_ios: Ok(Default::default()),
7415 rental_uri_web: Ok(Default::default()),
7416 return_constraint: Ok(Default::default()),
7417 station_name: Ok(Default::default()),
7418 system_id: Err("no value supplied for system_id".to_string()),
7419 system_name: Ok(Default::default()),
7420 to_station_name: Ok(Default::default()),
7421 url: Ok(Default::default()),
7422 }
7423 }
7424 }
7425
7426 impl Rental {
7427 pub fn form_factor<T>(mut self, value: T) -> Self
7428 where
7429 T: ::std::convert::TryInto<::std::option::Option<super::RentalFormFactor>>,
7430 T::Error: ::std::fmt::Display,
7431 {
7432 self.form_factor = value
7433 .try_into()
7434 .map_err(|e| format!("error converting supplied value for form_factor: {}", e));
7435 self
7436 }
7437 pub fn from_station_name<T>(mut self, value: T) -> Self
7438 where
7439 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7440 T::Error: ::std::fmt::Display,
7441 {
7442 self.from_station_name = value.try_into().map_err(|e| {
7443 format!(
7444 "error converting supplied value for from_station_name: {}",
7445 e
7446 )
7447 });
7448 self
7449 }
7450 pub fn propulsion_type<T>(mut self, value: T) -> Self
7451 where
7452 T: ::std::convert::TryInto<::std::option::Option<super::RentalPropulsionType>>,
7453 T::Error: ::std::fmt::Display,
7454 {
7455 self.propulsion_type = value.try_into().map_err(|e| {
7456 format!("error converting supplied value for propulsion_type: {}", e)
7457 });
7458 self
7459 }
7460 pub fn rental_uri_android<T>(mut self, value: T) -> Self
7461 where
7462 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7463 T::Error: ::std::fmt::Display,
7464 {
7465 self.rental_uri_android = value.try_into().map_err(|e| {
7466 format!(
7467 "error converting supplied value for rental_uri_android: {}",
7468 e
7469 )
7470 });
7471 self
7472 }
7473 pub fn rental_uri_ios<T>(mut self, value: T) -> Self
7474 where
7475 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7476 T::Error: ::std::fmt::Display,
7477 {
7478 self.rental_uri_ios = value.try_into().map_err(|e| {
7479 format!("error converting supplied value for rental_uri_ios: {}", e)
7480 });
7481 self
7482 }
7483 pub fn rental_uri_web<T>(mut self, value: T) -> Self
7484 where
7485 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7486 T::Error: ::std::fmt::Display,
7487 {
7488 self.rental_uri_web = value.try_into().map_err(|e| {
7489 format!("error converting supplied value for rental_uri_web: {}", e)
7490 });
7491 self
7492 }
7493 pub fn return_constraint<T>(mut self, value: T) -> Self
7494 where
7495 T: ::std::convert::TryInto<::std::option::Option<super::RentalReturnConstraint>>,
7496 T::Error: ::std::fmt::Display,
7497 {
7498 self.return_constraint = value.try_into().map_err(|e| {
7499 format!(
7500 "error converting supplied value for return_constraint: {}",
7501 e
7502 )
7503 });
7504 self
7505 }
7506 pub fn station_name<T>(mut self, value: T) -> Self
7507 where
7508 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7509 T::Error: ::std::fmt::Display,
7510 {
7511 self.station_name = value.try_into().map_err(|e| {
7512 format!("error converting supplied value for station_name: {}", e)
7513 });
7514 self
7515 }
7516 pub fn system_id<T>(mut self, value: T) -> Self
7517 where
7518 T: ::std::convert::TryInto<::std::string::String>,
7519 T::Error: ::std::fmt::Display,
7520 {
7521 self.system_id = value
7522 .try_into()
7523 .map_err(|e| format!("error converting supplied value for system_id: {}", e));
7524 self
7525 }
7526 pub fn system_name<T>(mut self, value: T) -> Self
7527 where
7528 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7529 T::Error: ::std::fmt::Display,
7530 {
7531 self.system_name = value
7532 .try_into()
7533 .map_err(|e| format!("error converting supplied value for system_name: {}", e));
7534 self
7535 }
7536 pub fn to_station_name<T>(mut self, value: T) -> Self
7537 where
7538 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7539 T::Error: ::std::fmt::Display,
7540 {
7541 self.to_station_name = value.try_into().map_err(|e| {
7542 format!("error converting supplied value for to_station_name: {}", e)
7543 });
7544 self
7545 }
7546 pub fn url<T>(mut self, value: T) -> Self
7547 where
7548 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7549 T::Error: ::std::fmt::Display,
7550 {
7551 self.url = value
7552 .try_into()
7553 .map_err(|e| format!("error converting supplied value for url: {}", e));
7554 self
7555 }
7556 }
7557
7558 impl ::std::convert::TryFrom<Rental> for super::Rental {
7559 type Error = super::error::ConversionError;
7560 fn try_from(
7561 value: Rental,
7562 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7563 Ok(Self {
7564 form_factor: value.form_factor?,
7565 from_station_name: value.from_station_name?,
7566 propulsion_type: value.propulsion_type?,
7567 rental_uri_android: value.rental_uri_android?,
7568 rental_uri_ios: value.rental_uri_ios?,
7569 rental_uri_web: value.rental_uri_web?,
7570 return_constraint: value.return_constraint?,
7571 station_name: value.station_name?,
7572 system_id: value.system_id?,
7573 system_name: value.system_name?,
7574 to_station_name: value.to_station_name?,
7575 url: value.url?,
7576 })
7577 }
7578 }
7579
7580 impl ::std::convert::From<super::Rental> for Rental {
7581 fn from(value: super::Rental) -> Self {
7582 Self {
7583 form_factor: Ok(value.form_factor),
7584 from_station_name: Ok(value.from_station_name),
7585 propulsion_type: Ok(value.propulsion_type),
7586 rental_uri_android: Ok(value.rental_uri_android),
7587 rental_uri_ios: Ok(value.rental_uri_ios),
7588 rental_uri_web: Ok(value.rental_uri_web),
7589 return_constraint: Ok(value.return_constraint),
7590 station_name: Ok(value.station_name),
7591 system_id: Ok(value.system_id),
7592 system_name: Ok(value.system_name),
7593 to_station_name: Ok(value.to_station_name),
7594 url: Ok(value.url),
7595 }
7596 }
7597 }
7598
7599 #[derive(Clone, Debug)]
7600 pub struct RiderCategory {
7601 eligibility_url: ::std::result::Result<
7602 ::std::option::Option<::std::string::String>,
7603 ::std::string::String,
7604 >,
7605 is_default_fare_category: ::std::result::Result<bool, ::std::string::String>,
7606 rider_category_name:
7607 ::std::result::Result<::std::string::String, ::std::string::String>,
7608 }
7609
7610 impl ::std::default::Default for RiderCategory {
7611 fn default() -> Self {
7612 Self {
7613 eligibility_url: Ok(Default::default()),
7614 is_default_fare_category: Err(
7615 "no value supplied for is_default_fare_category".to_string()
7616 ),
7617 rider_category_name: Err(
7618 "no value supplied for rider_category_name".to_string()
7619 ),
7620 }
7621 }
7622 }
7623
7624 impl RiderCategory {
7625 pub fn eligibility_url<T>(mut self, value: T) -> Self
7626 where
7627 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7628 T::Error: ::std::fmt::Display,
7629 {
7630 self.eligibility_url = value.try_into().map_err(|e| {
7631 format!("error converting supplied value for eligibility_url: {}", e)
7632 });
7633 self
7634 }
7635 pub fn is_default_fare_category<T>(mut self, value: T) -> Self
7636 where
7637 T: ::std::convert::TryInto<bool>,
7638 T::Error: ::std::fmt::Display,
7639 {
7640 self.is_default_fare_category = value.try_into().map_err(|e| {
7641 format!(
7642 "error converting supplied value for is_default_fare_category: {}",
7643 e
7644 )
7645 });
7646 self
7647 }
7648 pub fn rider_category_name<T>(mut self, value: T) -> Self
7649 where
7650 T: ::std::convert::TryInto<::std::string::String>,
7651 T::Error: ::std::fmt::Display,
7652 {
7653 self.rider_category_name = value.try_into().map_err(|e| {
7654 format!(
7655 "error converting supplied value for rider_category_name: {}",
7656 e
7657 )
7658 });
7659 self
7660 }
7661 }
7662
7663 impl ::std::convert::TryFrom<RiderCategory> for super::RiderCategory {
7664 type Error = super::error::ConversionError;
7665 fn try_from(
7666 value: RiderCategory,
7667 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7668 Ok(Self {
7669 eligibility_url: value.eligibility_url?,
7670 is_default_fare_category: value.is_default_fare_category?,
7671 rider_category_name: value.rider_category_name?,
7672 })
7673 }
7674 }
7675
7676 impl ::std::convert::From<super::RiderCategory> for RiderCategory {
7677 fn from(value: super::RiderCategory) -> Self {
7678 Self {
7679 eligibility_url: Ok(value.eligibility_url),
7680 is_default_fare_category: Ok(value.is_default_fare_category),
7681 rider_category_name: Ok(value.rider_category_name),
7682 }
7683 }
7684 }
7685
7686 #[derive(Clone, Debug)]
7687 pub struct StepInstruction {
7688 access_restriction: ::std::result::Result<
7689 ::std::option::Option<::std::string::String>,
7690 ::std::string::String,
7691 >,
7692 area: ::std::result::Result<bool, ::std::string::String>,
7693 distance: ::std::result::Result<f64, ::std::string::String>,
7694 elevation_down:
7695 ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
7696 elevation_up: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
7697 exit: ::std::result::Result<::std::string::String, ::std::string::String>,
7698 from_level: ::std::result::Result<f64, ::std::string::String>,
7699 osm_way: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
7700 polyline: ::std::result::Result<super::EncodedPolyline, ::std::string::String>,
7701 relative_direction: ::std::result::Result<super::Direction, ::std::string::String>,
7702 stay_on: ::std::result::Result<bool, ::std::string::String>,
7703 street_name: ::std::result::Result<::std::string::String, ::std::string::String>,
7704 to_level: ::std::result::Result<f64, ::std::string::String>,
7705 toll: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
7706 }
7707
7708 impl ::std::default::Default for StepInstruction {
7709 fn default() -> Self {
7710 Self {
7711 access_restriction: Ok(Default::default()),
7712 area: Err("no value supplied for area".to_string()),
7713 distance: Err("no value supplied for distance".to_string()),
7714 elevation_down: Ok(Default::default()),
7715 elevation_up: Ok(Default::default()),
7716 exit: Err("no value supplied for exit".to_string()),
7717 from_level: Err("no value supplied for from_level".to_string()),
7718 osm_way: Ok(Default::default()),
7719 polyline: Err("no value supplied for polyline".to_string()),
7720 relative_direction: Err("no value supplied for relative_direction".to_string()),
7721 stay_on: Err("no value supplied for stay_on".to_string()),
7722 street_name: Err("no value supplied for street_name".to_string()),
7723 to_level: Err("no value supplied for to_level".to_string()),
7724 toll: Ok(Default::default()),
7725 }
7726 }
7727 }
7728
7729 impl StepInstruction {
7730 pub fn access_restriction<T>(mut self, value: T) -> Self
7731 where
7732 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7733 T::Error: ::std::fmt::Display,
7734 {
7735 self.access_restriction = value.try_into().map_err(|e| {
7736 format!(
7737 "error converting supplied value for access_restriction: {}",
7738 e
7739 )
7740 });
7741 self
7742 }
7743 pub fn area<T>(mut self, value: T) -> Self
7744 where
7745 T: ::std::convert::TryInto<bool>,
7746 T::Error: ::std::fmt::Display,
7747 {
7748 self.area = value
7749 .try_into()
7750 .map_err(|e| format!("error converting supplied value for area: {}", e));
7751 self
7752 }
7753 pub fn distance<T>(mut self, value: T) -> Self
7754 where
7755 T: ::std::convert::TryInto<f64>,
7756 T::Error: ::std::fmt::Display,
7757 {
7758 self.distance = value
7759 .try_into()
7760 .map_err(|e| format!("error converting supplied value for distance: {}", e));
7761 self
7762 }
7763 pub fn elevation_down<T>(mut self, value: T) -> Self
7764 where
7765 T: ::std::convert::TryInto<::std::option::Option<i64>>,
7766 T::Error: ::std::fmt::Display,
7767 {
7768 self.elevation_down = value.try_into().map_err(|e| {
7769 format!("error converting supplied value for elevation_down: {}", e)
7770 });
7771 self
7772 }
7773 pub fn elevation_up<T>(mut self, value: T) -> Self
7774 where
7775 T: ::std::convert::TryInto<::std::option::Option<i64>>,
7776 T::Error: ::std::fmt::Display,
7777 {
7778 self.elevation_up = value.try_into().map_err(|e| {
7779 format!("error converting supplied value for elevation_up: {}", e)
7780 });
7781 self
7782 }
7783 pub fn exit<T>(mut self, value: T) -> Self
7784 where
7785 T: ::std::convert::TryInto<::std::string::String>,
7786 T::Error: ::std::fmt::Display,
7787 {
7788 self.exit = value
7789 .try_into()
7790 .map_err(|e| format!("error converting supplied value for exit: {}", e));
7791 self
7792 }
7793 pub fn from_level<T>(mut self, value: T) -> Self
7794 where
7795 T: ::std::convert::TryInto<f64>,
7796 T::Error: ::std::fmt::Display,
7797 {
7798 self.from_level = value
7799 .try_into()
7800 .map_err(|e| format!("error converting supplied value for from_level: {}", e));
7801 self
7802 }
7803 pub fn osm_way<T>(mut self, value: T) -> Self
7804 where
7805 T: ::std::convert::TryInto<::std::option::Option<i64>>,
7806 T::Error: ::std::fmt::Display,
7807 {
7808 self.osm_way = value
7809 .try_into()
7810 .map_err(|e| format!("error converting supplied value for osm_way: {}", e));
7811 self
7812 }
7813 pub fn polyline<T>(mut self, value: T) -> Self
7814 where
7815 T: ::std::convert::TryInto<super::EncodedPolyline>,
7816 T::Error: ::std::fmt::Display,
7817 {
7818 self.polyline = value
7819 .try_into()
7820 .map_err(|e| format!("error converting supplied value for polyline: {}", e));
7821 self
7822 }
7823 pub fn relative_direction<T>(mut self, value: T) -> Self
7824 where
7825 T: ::std::convert::TryInto<super::Direction>,
7826 T::Error: ::std::fmt::Display,
7827 {
7828 self.relative_direction = value.try_into().map_err(|e| {
7829 format!(
7830 "error converting supplied value for relative_direction: {}",
7831 e
7832 )
7833 });
7834 self
7835 }
7836 pub fn stay_on<T>(mut self, value: T) -> Self
7837 where
7838 T: ::std::convert::TryInto<bool>,
7839 T::Error: ::std::fmt::Display,
7840 {
7841 self.stay_on = value
7842 .try_into()
7843 .map_err(|e| format!("error converting supplied value for stay_on: {}", e));
7844 self
7845 }
7846 pub fn street_name<T>(mut self, value: T) -> Self
7847 where
7848 T: ::std::convert::TryInto<::std::string::String>,
7849 T::Error: ::std::fmt::Display,
7850 {
7851 self.street_name = value
7852 .try_into()
7853 .map_err(|e| format!("error converting supplied value for street_name: {}", e));
7854 self
7855 }
7856 pub fn to_level<T>(mut self, value: T) -> Self
7857 where
7858 T: ::std::convert::TryInto<f64>,
7859 T::Error: ::std::fmt::Display,
7860 {
7861 self.to_level = value
7862 .try_into()
7863 .map_err(|e| format!("error converting supplied value for to_level: {}", e));
7864 self
7865 }
7866 pub fn toll<T>(mut self, value: T) -> Self
7867 where
7868 T: ::std::convert::TryInto<::std::option::Option<bool>>,
7869 T::Error: ::std::fmt::Display,
7870 {
7871 self.toll = value
7872 .try_into()
7873 .map_err(|e| format!("error converting supplied value for toll: {}", e));
7874 self
7875 }
7876 }
7877
7878 impl ::std::convert::TryFrom<StepInstruction> for super::StepInstruction {
7879 type Error = super::error::ConversionError;
7880 fn try_from(
7881 value: StepInstruction,
7882 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7883 Ok(Self {
7884 access_restriction: value.access_restriction?,
7885 area: value.area?,
7886 distance: value.distance?,
7887 elevation_down: value.elevation_down?,
7888 elevation_up: value.elevation_up?,
7889 exit: value.exit?,
7890 from_level: value.from_level?,
7891 osm_way: value.osm_way?,
7892 polyline: value.polyline?,
7893 relative_direction: value.relative_direction?,
7894 stay_on: value.stay_on?,
7895 street_name: value.street_name?,
7896 to_level: value.to_level?,
7897 toll: value.toll?,
7898 })
7899 }
7900 }
7901
7902 impl ::std::convert::From<super::StepInstruction> for StepInstruction {
7903 fn from(value: super::StepInstruction) -> Self {
7904 Self {
7905 access_restriction: Ok(value.access_restriction),
7906 area: Ok(value.area),
7907 distance: Ok(value.distance),
7908 elevation_down: Ok(value.elevation_down),
7909 elevation_up: Ok(value.elevation_up),
7910 exit: Ok(value.exit),
7911 from_level: Ok(value.from_level),
7912 osm_way: Ok(value.osm_way),
7913 polyline: Ok(value.polyline),
7914 relative_direction: Ok(value.relative_direction),
7915 stay_on: Ok(value.stay_on),
7916 street_name: Ok(value.street_name),
7917 to_level: Ok(value.to_level),
7918 toll: Ok(value.toll),
7919 }
7920 }
7921 }
7922
7923 #[derive(Clone, Debug)]
7924 pub struct StopTime {
7925 agency_id: ::std::result::Result<::std::string::String, ::std::string::String>,
7926 agency_name: ::std::result::Result<::std::string::String, ::std::string::String>,
7927 agency_url: ::std::result::Result<::std::string::String, ::std::string::String>,
7928 cancelled: ::std::result::Result<bool, ::std::string::String>,
7929 display_name: ::std::result::Result<::std::string::String, ::std::string::String>,
7930 headsign: ::std::result::Result<::std::string::String, ::std::string::String>,
7931 mode: ::std::result::Result<super::Mode, ::std::string::String>,
7932 next_stops: ::std::result::Result<::std::vec::Vec<super::Place>, ::std::string::String>,
7933 pickup_dropoff_type:
7934 ::std::result::Result<super::PickupDropoffType, ::std::string::String>,
7935 place: ::std::result::Result<super::Place, ::std::string::String>,
7936 previous_stops:
7937 ::std::result::Result<::std::vec::Vec<super::Place>, ::std::string::String>,
7938 real_time: ::std::result::Result<bool, ::std::string::String>,
7939 route_color: ::std::result::Result<
7940 ::std::option::Option<::std::string::String>,
7941 ::std::string::String,
7942 >,
7943 route_long_name: ::std::result::Result<::std::string::String, ::std::string::String>,
7944 route_short_name: ::std::result::Result<::std::string::String, ::std::string::String>,
7945 route_text_color: ::std::result::Result<
7946 ::std::option::Option<::std::string::String>,
7947 ::std::string::String,
7948 >,
7949 route_type: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
7950 source: ::std::result::Result<::std::string::String, ::std::string::String>,
7951 trip_cancelled: ::std::result::Result<bool, ::std::string::String>,
7952 trip_id: ::std::result::Result<::std::string::String, ::std::string::String>,
7953 trip_short_name: ::std::result::Result<::std::string::String, ::std::string::String>,
7954 trip_to: ::std::result::Result<super::Place, ::std::string::String>,
7955 }
7956
7957 impl ::std::default::Default for StopTime {
7958 fn default() -> Self {
7959 Self {
7960 agency_id: Err("no value supplied for agency_id".to_string()),
7961 agency_name: Err("no value supplied for agency_name".to_string()),
7962 agency_url: Err("no value supplied for agency_url".to_string()),
7963 cancelled: Err("no value supplied for cancelled".to_string()),
7964 display_name: Err("no value supplied for display_name".to_string()),
7965 headsign: Err("no value supplied for headsign".to_string()),
7966 mode: Err("no value supplied for mode".to_string()),
7967 next_stops: Ok(Default::default()),
7968 pickup_dropoff_type: Err(
7969 "no value supplied for pickup_dropoff_type".to_string()
7970 ),
7971 place: Err("no value supplied for place".to_string()),
7972 previous_stops: Ok(Default::default()),
7973 real_time: Err("no value supplied for real_time".to_string()),
7974 route_color: Ok(Default::default()),
7975 route_long_name: Err("no value supplied for route_long_name".to_string()),
7976 route_short_name: Err("no value supplied for route_short_name".to_string()),
7977 route_text_color: Ok(Default::default()),
7978 route_type: Ok(Default::default()),
7979 source: Err("no value supplied for source".to_string()),
7980 trip_cancelled: Err("no value supplied for trip_cancelled".to_string()),
7981 trip_id: Err("no value supplied for trip_id".to_string()),
7982 trip_short_name: Err("no value supplied for trip_short_name".to_string()),
7983 trip_to: Err("no value supplied for trip_to".to_string()),
7984 }
7985 }
7986 }
7987
7988 impl StopTime {
7989 pub fn agency_id<T>(mut self, value: T) -> Self
7990 where
7991 T: ::std::convert::TryInto<::std::string::String>,
7992 T::Error: ::std::fmt::Display,
7993 {
7994 self.agency_id = value
7995 .try_into()
7996 .map_err(|e| format!("error converting supplied value for agency_id: {}", e));
7997 self
7998 }
7999 pub fn agency_name<T>(mut self, value: T) -> Self
8000 where
8001 T: ::std::convert::TryInto<::std::string::String>,
8002 T::Error: ::std::fmt::Display,
8003 {
8004 self.agency_name = value
8005 .try_into()
8006 .map_err(|e| format!("error converting supplied value for agency_name: {}", e));
8007 self
8008 }
8009 pub fn agency_url<T>(mut self, value: T) -> Self
8010 where
8011 T: ::std::convert::TryInto<::std::string::String>,
8012 T::Error: ::std::fmt::Display,
8013 {
8014 self.agency_url = value
8015 .try_into()
8016 .map_err(|e| format!("error converting supplied value for agency_url: {}", e));
8017 self
8018 }
8019 pub fn cancelled<T>(mut self, value: T) -> Self
8020 where
8021 T: ::std::convert::TryInto<bool>,
8022 T::Error: ::std::fmt::Display,
8023 {
8024 self.cancelled = value
8025 .try_into()
8026 .map_err(|e| format!("error converting supplied value for cancelled: {}", e));
8027 self
8028 }
8029 pub fn display_name<T>(mut self, value: T) -> Self
8030 where
8031 T: ::std::convert::TryInto<::std::string::String>,
8032 T::Error: ::std::fmt::Display,
8033 {
8034 self.display_name = value.try_into().map_err(|e| {
8035 format!("error converting supplied value for display_name: {}", e)
8036 });
8037 self
8038 }
8039 pub fn headsign<T>(mut self, value: T) -> Self
8040 where
8041 T: ::std::convert::TryInto<::std::string::String>,
8042 T::Error: ::std::fmt::Display,
8043 {
8044 self.headsign = value
8045 .try_into()
8046 .map_err(|e| format!("error converting supplied value for headsign: {}", e));
8047 self
8048 }
8049 pub fn mode<T>(mut self, value: T) -> Self
8050 where
8051 T: ::std::convert::TryInto<super::Mode>,
8052 T::Error: ::std::fmt::Display,
8053 {
8054 self.mode = value
8055 .try_into()
8056 .map_err(|e| format!("error converting supplied value for mode: {}", e));
8057 self
8058 }
8059 pub fn next_stops<T>(mut self, value: T) -> Self
8060 where
8061 T: ::std::convert::TryInto<::std::vec::Vec<super::Place>>,
8062 T::Error: ::std::fmt::Display,
8063 {
8064 self.next_stops = value
8065 .try_into()
8066 .map_err(|e| format!("error converting supplied value for next_stops: {}", e));
8067 self
8068 }
8069 pub fn pickup_dropoff_type<T>(mut self, value: T) -> Self
8070 where
8071 T: ::std::convert::TryInto<super::PickupDropoffType>,
8072 T::Error: ::std::fmt::Display,
8073 {
8074 self.pickup_dropoff_type = value.try_into().map_err(|e| {
8075 format!(
8076 "error converting supplied value for pickup_dropoff_type: {}",
8077 e
8078 )
8079 });
8080 self
8081 }
8082 pub fn place<T>(mut self, value: T) -> Self
8083 where
8084 T: ::std::convert::TryInto<super::Place>,
8085 T::Error: ::std::fmt::Display,
8086 {
8087 self.place = value
8088 .try_into()
8089 .map_err(|e| format!("error converting supplied value for place: {}", e));
8090 self
8091 }
8092 pub fn previous_stops<T>(mut self, value: T) -> Self
8093 where
8094 T: ::std::convert::TryInto<::std::vec::Vec<super::Place>>,
8095 T::Error: ::std::fmt::Display,
8096 {
8097 self.previous_stops = value.try_into().map_err(|e| {
8098 format!("error converting supplied value for previous_stops: {}", e)
8099 });
8100 self
8101 }
8102 pub fn real_time<T>(mut self, value: T) -> Self
8103 where
8104 T: ::std::convert::TryInto<bool>,
8105 T::Error: ::std::fmt::Display,
8106 {
8107 self.real_time = value
8108 .try_into()
8109 .map_err(|e| format!("error converting supplied value for real_time: {}", e));
8110 self
8111 }
8112 pub fn route_color<T>(mut self, value: T) -> Self
8113 where
8114 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8115 T::Error: ::std::fmt::Display,
8116 {
8117 self.route_color = value
8118 .try_into()
8119 .map_err(|e| format!("error converting supplied value for route_color: {}", e));
8120 self
8121 }
8122 pub fn route_long_name<T>(mut self, value: T) -> Self
8123 where
8124 T: ::std::convert::TryInto<::std::string::String>,
8125 T::Error: ::std::fmt::Display,
8126 {
8127 self.route_long_name = value.try_into().map_err(|e| {
8128 format!("error converting supplied value for route_long_name: {}", e)
8129 });
8130 self
8131 }
8132 pub fn route_short_name<T>(mut self, value: T) -> Self
8133 where
8134 T: ::std::convert::TryInto<::std::string::String>,
8135 T::Error: ::std::fmt::Display,
8136 {
8137 self.route_short_name = value.try_into().map_err(|e| {
8138 format!(
8139 "error converting supplied value for route_short_name: {}",
8140 e
8141 )
8142 });
8143 self
8144 }
8145 pub fn route_text_color<T>(mut self, value: T) -> Self
8146 where
8147 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8148 T::Error: ::std::fmt::Display,
8149 {
8150 self.route_text_color = value.try_into().map_err(|e| {
8151 format!(
8152 "error converting supplied value for route_text_color: {}",
8153 e
8154 )
8155 });
8156 self
8157 }
8158 pub fn route_type<T>(mut self, value: T) -> Self
8159 where
8160 T: ::std::convert::TryInto<::std::option::Option<i64>>,
8161 T::Error: ::std::fmt::Display,
8162 {
8163 self.route_type = value
8164 .try_into()
8165 .map_err(|e| format!("error converting supplied value for route_type: {}", e));
8166 self
8167 }
8168 pub fn source<T>(mut self, value: T) -> Self
8169 where
8170 T: ::std::convert::TryInto<::std::string::String>,
8171 T::Error: ::std::fmt::Display,
8172 {
8173 self.source = value
8174 .try_into()
8175 .map_err(|e| format!("error converting supplied value for source: {}", e));
8176 self
8177 }
8178 pub fn trip_cancelled<T>(mut self, value: T) -> Self
8179 where
8180 T: ::std::convert::TryInto<bool>,
8181 T::Error: ::std::fmt::Display,
8182 {
8183 self.trip_cancelled = value.try_into().map_err(|e| {
8184 format!("error converting supplied value for trip_cancelled: {}", e)
8185 });
8186 self
8187 }
8188 pub fn trip_id<T>(mut self, value: T) -> Self
8189 where
8190 T: ::std::convert::TryInto<::std::string::String>,
8191 T::Error: ::std::fmt::Display,
8192 {
8193 self.trip_id = value
8194 .try_into()
8195 .map_err(|e| format!("error converting supplied value for trip_id: {}", e));
8196 self
8197 }
8198 pub fn trip_short_name<T>(mut self, value: T) -> Self
8199 where
8200 T: ::std::convert::TryInto<::std::string::String>,
8201 T::Error: ::std::fmt::Display,
8202 {
8203 self.trip_short_name = value.try_into().map_err(|e| {
8204 format!("error converting supplied value for trip_short_name: {}", e)
8205 });
8206 self
8207 }
8208 pub fn trip_to<T>(mut self, value: T) -> Self
8209 where
8210 T: ::std::convert::TryInto<super::Place>,
8211 T::Error: ::std::fmt::Display,
8212 {
8213 self.trip_to = value
8214 .try_into()
8215 .map_err(|e| format!("error converting supplied value for trip_to: {}", e));
8216 self
8217 }
8218 }
8219
8220 impl ::std::convert::TryFrom<StopTime> for super::StopTime {
8221 type Error = super::error::ConversionError;
8222 fn try_from(
8223 value: StopTime,
8224 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8225 Ok(Self {
8226 agency_id: value.agency_id?,
8227 agency_name: value.agency_name?,
8228 agency_url: value.agency_url?,
8229 cancelled: value.cancelled?,
8230 display_name: value.display_name?,
8231 headsign: value.headsign?,
8232 mode: value.mode?,
8233 next_stops: value.next_stops?,
8234 pickup_dropoff_type: value.pickup_dropoff_type?,
8235 place: value.place?,
8236 previous_stops: value.previous_stops?,
8237 real_time: value.real_time?,
8238 route_color: value.route_color?,
8239 route_long_name: value.route_long_name?,
8240 route_short_name: value.route_short_name?,
8241 route_text_color: value.route_text_color?,
8242 route_type: value.route_type?,
8243 source: value.source?,
8244 trip_cancelled: value.trip_cancelled?,
8245 trip_id: value.trip_id?,
8246 trip_short_name: value.trip_short_name?,
8247 trip_to: value.trip_to?,
8248 })
8249 }
8250 }
8251
8252 impl ::std::convert::From<super::StopTime> for StopTime {
8253 fn from(value: super::StopTime) -> Self {
8254 Self {
8255 agency_id: Ok(value.agency_id),
8256 agency_name: Ok(value.agency_name),
8257 agency_url: Ok(value.agency_url),
8258 cancelled: Ok(value.cancelled),
8259 display_name: Ok(value.display_name),
8260 headsign: Ok(value.headsign),
8261 mode: Ok(value.mode),
8262 next_stops: Ok(value.next_stops),
8263 pickup_dropoff_type: Ok(value.pickup_dropoff_type),
8264 place: Ok(value.place),
8265 previous_stops: Ok(value.previous_stops),
8266 real_time: Ok(value.real_time),
8267 route_color: Ok(value.route_color),
8268 route_long_name: Ok(value.route_long_name),
8269 route_short_name: Ok(value.route_short_name),
8270 route_text_color: Ok(value.route_text_color),
8271 route_type: Ok(value.route_type),
8272 source: Ok(value.source),
8273 trip_cancelled: Ok(value.trip_cancelled),
8274 trip_id: Ok(value.trip_id),
8275 trip_short_name: Ok(value.trip_short_name),
8276 trip_to: Ok(value.trip_to),
8277 }
8278 }
8279 }
8280
8281 #[derive(Clone, Debug)]
8282 pub struct StoptimesResponse {
8283 next_page_cursor: ::std::result::Result<::std::string::String, ::std::string::String>,
8284 place: ::std::result::Result<super::Place, ::std::string::String>,
8285 previous_page_cursor:
8286 ::std::result::Result<::std::string::String, ::std::string::String>,
8287 stop_times:
8288 ::std::result::Result<::std::vec::Vec<super::StopTime>, ::std::string::String>,
8289 }
8290
8291 impl ::std::default::Default for StoptimesResponse {
8292 fn default() -> Self {
8293 Self {
8294 next_page_cursor: Err("no value supplied for next_page_cursor".to_string()),
8295 place: Err("no value supplied for place".to_string()),
8296 previous_page_cursor: Err(
8297 "no value supplied for previous_page_cursor".to_string()
8298 ),
8299 stop_times: Err("no value supplied for stop_times".to_string()),
8300 }
8301 }
8302 }
8303
8304 impl StoptimesResponse {
8305 pub fn next_page_cursor<T>(mut self, value: T) -> Self
8306 where
8307 T: ::std::convert::TryInto<::std::string::String>,
8308 T::Error: ::std::fmt::Display,
8309 {
8310 self.next_page_cursor = value.try_into().map_err(|e| {
8311 format!(
8312 "error converting supplied value for next_page_cursor: {}",
8313 e
8314 )
8315 });
8316 self
8317 }
8318 pub fn place<T>(mut self, value: T) -> Self
8319 where
8320 T: ::std::convert::TryInto<super::Place>,
8321 T::Error: ::std::fmt::Display,
8322 {
8323 self.place = value
8324 .try_into()
8325 .map_err(|e| format!("error converting supplied value for place: {}", e));
8326 self
8327 }
8328 pub fn previous_page_cursor<T>(mut self, value: T) -> Self
8329 where
8330 T: ::std::convert::TryInto<::std::string::String>,
8331 T::Error: ::std::fmt::Display,
8332 {
8333 self.previous_page_cursor = value.try_into().map_err(|e| {
8334 format!(
8335 "error converting supplied value for previous_page_cursor: {}",
8336 e
8337 )
8338 });
8339 self
8340 }
8341 pub fn stop_times<T>(mut self, value: T) -> Self
8342 where
8343 T: ::std::convert::TryInto<::std::vec::Vec<super::StopTime>>,
8344 T::Error: ::std::fmt::Display,
8345 {
8346 self.stop_times = value
8347 .try_into()
8348 .map_err(|e| format!("error converting supplied value for stop_times: {}", e));
8349 self
8350 }
8351 }
8352
8353 impl ::std::convert::TryFrom<StoptimesResponse> for super::StoptimesResponse {
8354 type Error = super::error::ConversionError;
8355 fn try_from(
8356 value: StoptimesResponse,
8357 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8358 Ok(Self {
8359 next_page_cursor: value.next_page_cursor?,
8360 place: value.place?,
8361 previous_page_cursor: value.previous_page_cursor?,
8362 stop_times: value.stop_times?,
8363 })
8364 }
8365 }
8366
8367 impl ::std::convert::From<super::StoptimesResponse> for StoptimesResponse {
8368 fn from(value: super::StoptimesResponse) -> Self {
8369 Self {
8370 next_page_cursor: Ok(value.next_page_cursor),
8371 place: Ok(value.place),
8372 previous_page_cursor: Ok(value.previous_page_cursor),
8373 stop_times: Ok(value.stop_times),
8374 }
8375 }
8376 }
8377
8378 #[derive(Clone, Debug)]
8379 pub struct TimeRange {
8380 end: ::std::result::Result<
8381 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
8382 ::std::string::String,
8383 >,
8384 start: ::std::result::Result<
8385 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
8386 ::std::string::String,
8387 >,
8388 }
8389
8390 impl ::std::default::Default for TimeRange {
8391 fn default() -> Self {
8392 Self {
8393 end: Ok(Default::default()),
8394 start: Ok(Default::default()),
8395 }
8396 }
8397 }
8398
8399 impl TimeRange {
8400 pub fn end<T>(mut self, value: T) -> Self
8401 where
8402 T: ::std::convert::TryInto<
8403 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
8404 >,
8405 T::Error: ::std::fmt::Display,
8406 {
8407 self.end = value
8408 .try_into()
8409 .map_err(|e| format!("error converting supplied value for end: {}", e));
8410 self
8411 }
8412 pub fn start<T>(mut self, value: T) -> Self
8413 where
8414 T: ::std::convert::TryInto<
8415 ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
8416 >,
8417 T::Error: ::std::fmt::Display,
8418 {
8419 self.start = value
8420 .try_into()
8421 .map_err(|e| format!("error converting supplied value for start: {}", e));
8422 self
8423 }
8424 }
8425
8426 impl ::std::convert::TryFrom<TimeRange> for super::TimeRange {
8427 type Error = super::error::ConversionError;
8428 fn try_from(
8429 value: TimeRange,
8430 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8431 Ok(Self {
8432 end: value.end?,
8433 start: value.start?,
8434 })
8435 }
8436 }
8437
8438 impl ::std::convert::From<super::TimeRange> for TimeRange {
8439 fn from(value: super::TimeRange) -> Self {
8440 Self {
8441 end: Ok(value.end),
8442 start: Ok(value.start),
8443 }
8444 }
8445 }
8446
8447 #[derive(Clone, Debug)]
8448 pub struct Transfer {
8449 car: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
8450 default: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
8451 foot: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
8452 foot_routed: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
8453 to: ::std::result::Result<super::Place, ::std::string::String>,
8454 wheelchair: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
8455 wheelchair_routed:
8456 ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
8457 wheelchair_uses_elevator:
8458 ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
8459 }
8460
8461 impl ::std::default::Default for Transfer {
8462 fn default() -> Self {
8463 Self {
8464 car: Ok(Default::default()),
8465 default: Ok(Default::default()),
8466 foot: Ok(Default::default()),
8467 foot_routed: Ok(Default::default()),
8468 to: Err("no value supplied for to".to_string()),
8469 wheelchair: Ok(Default::default()),
8470 wheelchair_routed: Ok(Default::default()),
8471 wheelchair_uses_elevator: Ok(Default::default()),
8472 }
8473 }
8474 }
8475
8476 impl Transfer {
8477 pub fn car<T>(mut self, value: T) -> Self
8478 where
8479 T: ::std::convert::TryInto<::std::option::Option<f64>>,
8480 T::Error: ::std::fmt::Display,
8481 {
8482 self.car = value
8483 .try_into()
8484 .map_err(|e| format!("error converting supplied value for car: {}", e));
8485 self
8486 }
8487 pub fn default<T>(mut self, value: T) -> Self
8488 where
8489 T: ::std::convert::TryInto<::std::option::Option<f64>>,
8490 T::Error: ::std::fmt::Display,
8491 {
8492 self.default = value
8493 .try_into()
8494 .map_err(|e| format!("error converting supplied value for default: {}", e));
8495 self
8496 }
8497 pub fn foot<T>(mut self, value: T) -> Self
8498 where
8499 T: ::std::convert::TryInto<::std::option::Option<f64>>,
8500 T::Error: ::std::fmt::Display,
8501 {
8502 self.foot = value
8503 .try_into()
8504 .map_err(|e| format!("error converting supplied value for foot: {}", e));
8505 self
8506 }
8507 pub fn foot_routed<T>(mut self, value: T) -> Self
8508 where
8509 T: ::std::convert::TryInto<::std::option::Option<f64>>,
8510 T::Error: ::std::fmt::Display,
8511 {
8512 self.foot_routed = value
8513 .try_into()
8514 .map_err(|e| format!("error converting supplied value for foot_routed: {}", e));
8515 self
8516 }
8517 pub fn to<T>(mut self, value: T) -> Self
8518 where
8519 T: ::std::convert::TryInto<super::Place>,
8520 T::Error: ::std::fmt::Display,
8521 {
8522 self.to = value
8523 .try_into()
8524 .map_err(|e| format!("error converting supplied value for to: {}", e));
8525 self
8526 }
8527 pub fn wheelchair<T>(mut self, value: T) -> Self
8528 where
8529 T: ::std::convert::TryInto<::std::option::Option<f64>>,
8530 T::Error: ::std::fmt::Display,
8531 {
8532 self.wheelchair = value
8533 .try_into()
8534 .map_err(|e| format!("error converting supplied value for wheelchair: {}", e));
8535 self
8536 }
8537 pub fn wheelchair_routed<T>(mut self, value: T) -> Self
8538 where
8539 T: ::std::convert::TryInto<::std::option::Option<f64>>,
8540 T::Error: ::std::fmt::Display,
8541 {
8542 self.wheelchair_routed = value.try_into().map_err(|e| {
8543 format!(
8544 "error converting supplied value for wheelchair_routed: {}",
8545 e
8546 )
8547 });
8548 self
8549 }
8550 pub fn wheelchair_uses_elevator<T>(mut self, value: T) -> Self
8551 where
8552 T: ::std::convert::TryInto<::std::option::Option<bool>>,
8553 T::Error: ::std::fmt::Display,
8554 {
8555 self.wheelchair_uses_elevator = value.try_into().map_err(|e| {
8556 format!(
8557 "error converting supplied value for wheelchair_uses_elevator: {}",
8558 e
8559 )
8560 });
8561 self
8562 }
8563 }
8564
8565 impl ::std::convert::TryFrom<Transfer> for super::Transfer {
8566 type Error = super::error::ConversionError;
8567 fn try_from(
8568 value: Transfer,
8569 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8570 Ok(Self {
8571 car: value.car?,
8572 default: value.default?,
8573 foot: value.foot?,
8574 foot_routed: value.foot_routed?,
8575 to: value.to?,
8576 wheelchair: value.wheelchair?,
8577 wheelchair_routed: value.wheelchair_routed?,
8578 wheelchair_uses_elevator: value.wheelchair_uses_elevator?,
8579 })
8580 }
8581 }
8582
8583 impl ::std::convert::From<super::Transfer> for Transfer {
8584 fn from(value: super::Transfer) -> Self {
8585 Self {
8586 car: Ok(value.car),
8587 default: Ok(value.default),
8588 foot: Ok(value.foot),
8589 foot_routed: Ok(value.foot_routed),
8590 to: Ok(value.to),
8591 wheelchair: Ok(value.wheelchair),
8592 wheelchair_routed: Ok(value.wheelchair_routed),
8593 wheelchair_uses_elevator: Ok(value.wheelchair_uses_elevator),
8594 }
8595 }
8596 }
8597
8598 #[derive(Clone, Debug)]
8599 pub struct TransfersResponse {
8600 has_car_transfers: ::std::result::Result<bool, ::std::string::String>,
8601 has_foot_transfers: ::std::result::Result<bool, ::std::string::String>,
8602 has_wheelchair_transfers: ::std::result::Result<bool, ::std::string::String>,
8603 place: ::std::result::Result<super::Place, ::std::string::String>,
8604 transfers:
8605 ::std::result::Result<::std::vec::Vec<super::Transfer>, ::std::string::String>,
8606 }
8607
8608 impl ::std::default::Default for TransfersResponse {
8609 fn default() -> Self {
8610 Self {
8611 has_car_transfers: Err("no value supplied for has_car_transfers".to_string()),
8612 has_foot_transfers: Err("no value supplied for has_foot_transfers".to_string()),
8613 has_wheelchair_transfers: Err(
8614 "no value supplied for has_wheelchair_transfers".to_string()
8615 ),
8616 place: Err("no value supplied for place".to_string()),
8617 transfers: Err("no value supplied for transfers".to_string()),
8618 }
8619 }
8620 }
8621
8622 impl TransfersResponse {
8623 pub fn has_car_transfers<T>(mut self, value: T) -> Self
8624 where
8625 T: ::std::convert::TryInto<bool>,
8626 T::Error: ::std::fmt::Display,
8627 {
8628 self.has_car_transfers = value.try_into().map_err(|e| {
8629 format!(
8630 "error converting supplied value for has_car_transfers: {}",
8631 e
8632 )
8633 });
8634 self
8635 }
8636 pub fn has_foot_transfers<T>(mut self, value: T) -> Self
8637 where
8638 T: ::std::convert::TryInto<bool>,
8639 T::Error: ::std::fmt::Display,
8640 {
8641 self.has_foot_transfers = value.try_into().map_err(|e| {
8642 format!(
8643 "error converting supplied value for has_foot_transfers: {}",
8644 e
8645 )
8646 });
8647 self
8648 }
8649 pub fn has_wheelchair_transfers<T>(mut self, value: T) -> Self
8650 where
8651 T: ::std::convert::TryInto<bool>,
8652 T::Error: ::std::fmt::Display,
8653 {
8654 self.has_wheelchair_transfers = value.try_into().map_err(|e| {
8655 format!(
8656 "error converting supplied value for has_wheelchair_transfers: {}",
8657 e
8658 )
8659 });
8660 self
8661 }
8662 pub fn place<T>(mut self, value: T) -> Self
8663 where
8664 T: ::std::convert::TryInto<super::Place>,
8665 T::Error: ::std::fmt::Display,
8666 {
8667 self.place = value
8668 .try_into()
8669 .map_err(|e| format!("error converting supplied value for place: {}", e));
8670 self
8671 }
8672 pub fn transfers<T>(mut self, value: T) -> Self
8673 where
8674 T: ::std::convert::TryInto<::std::vec::Vec<super::Transfer>>,
8675 T::Error: ::std::fmt::Display,
8676 {
8677 self.transfers = value
8678 .try_into()
8679 .map_err(|e| format!("error converting supplied value for transfers: {}", e));
8680 self
8681 }
8682 }
8683
8684 impl ::std::convert::TryFrom<TransfersResponse> for super::TransfersResponse {
8685 type Error = super::error::ConversionError;
8686 fn try_from(
8687 value: TransfersResponse,
8688 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8689 Ok(Self {
8690 has_car_transfers: value.has_car_transfers?,
8691 has_foot_transfers: value.has_foot_transfers?,
8692 has_wheelchair_transfers: value.has_wheelchair_transfers?,
8693 place: value.place?,
8694 transfers: value.transfers?,
8695 })
8696 }
8697 }
8698
8699 impl ::std::convert::From<super::TransfersResponse> for TransfersResponse {
8700 fn from(value: super::TransfersResponse) -> Self {
8701 Self {
8702 has_car_transfers: Ok(value.has_car_transfers),
8703 has_foot_transfers: Ok(value.has_foot_transfers),
8704 has_wheelchair_transfers: Ok(value.has_wheelchair_transfers),
8705 place: Ok(value.place),
8706 transfers: Ok(value.transfers),
8707 }
8708 }
8709 }
8710
8711 #[derive(Clone, Debug)]
8712 pub struct TripInfo {
8713 display_name: ::std::result::Result<
8714 ::std::option::Option<::std::string::String>,
8715 ::std::string::String,
8716 >,
8717 route_short_name: ::std::result::Result<
8718 ::std::option::Option<::std::string::String>,
8719 ::std::string::String,
8720 >,
8721 trip_id: ::std::result::Result<::std::string::String, ::std::string::String>,
8722 }
8723
8724 impl ::std::default::Default for TripInfo {
8725 fn default() -> Self {
8726 Self {
8727 display_name: Ok(Default::default()),
8728 route_short_name: Ok(Default::default()),
8729 trip_id: Err("no value supplied for trip_id".to_string()),
8730 }
8731 }
8732 }
8733
8734 impl TripInfo {
8735 pub fn display_name<T>(mut self, value: T) -> Self
8736 where
8737 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8738 T::Error: ::std::fmt::Display,
8739 {
8740 self.display_name = value.try_into().map_err(|e| {
8741 format!("error converting supplied value for display_name: {}", e)
8742 });
8743 self
8744 }
8745 pub fn route_short_name<T>(mut self, value: T) -> Self
8746 where
8747 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8748 T::Error: ::std::fmt::Display,
8749 {
8750 self.route_short_name = value.try_into().map_err(|e| {
8751 format!(
8752 "error converting supplied value for route_short_name: {}",
8753 e
8754 )
8755 });
8756 self
8757 }
8758 pub fn trip_id<T>(mut self, value: T) -> Self
8759 where
8760 T: ::std::convert::TryInto<::std::string::String>,
8761 T::Error: ::std::fmt::Display,
8762 {
8763 self.trip_id = value
8764 .try_into()
8765 .map_err(|e| format!("error converting supplied value for trip_id: {}", e));
8766 self
8767 }
8768 }
8769
8770 impl ::std::convert::TryFrom<TripInfo> for super::TripInfo {
8771 type Error = super::error::ConversionError;
8772 fn try_from(
8773 value: TripInfo,
8774 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8775 Ok(Self {
8776 display_name: value.display_name?,
8777 route_short_name: value.route_short_name?,
8778 trip_id: value.trip_id?,
8779 })
8780 }
8781 }
8782
8783 impl ::std::convert::From<super::TripInfo> for TripInfo {
8784 fn from(value: super::TripInfo) -> Self {
8785 Self {
8786 display_name: Ok(value.display_name),
8787 route_short_name: Ok(value.route_short_name),
8788 trip_id: Ok(value.trip_id),
8789 }
8790 }
8791 }
8792
8793 #[derive(Clone, Debug)]
8794 pub struct TripSegment {
8795 arrival: ::std::result::Result<
8796 ::chrono::DateTime<::chrono::offset::Utc>,
8797 ::std::string::String,
8798 >,
8799 departure: ::std::result::Result<
8800 ::chrono::DateTime<::chrono::offset::Utc>,
8801 ::std::string::String,
8802 >,
8803 distance: ::std::result::Result<f64, ::std::string::String>,
8804 from: ::std::result::Result<super::Place, ::std::string::String>,
8805 mode: ::std::result::Result<super::Mode, ::std::string::String>,
8806 polyline: ::std::result::Result<::std::string::String, ::std::string::String>,
8807 real_time: ::std::result::Result<bool, ::std::string::String>,
8808 route_color: ::std::result::Result<
8809 ::std::option::Option<::std::string::String>,
8810 ::std::string::String,
8811 >,
8812 scheduled_arrival: ::std::result::Result<
8813 ::chrono::DateTime<::chrono::offset::Utc>,
8814 ::std::string::String,
8815 >,
8816 scheduled_departure: ::std::result::Result<
8817 ::chrono::DateTime<::chrono::offset::Utc>,
8818 ::std::string::String,
8819 >,
8820 to: ::std::result::Result<super::Place, ::std::string::String>,
8821 trips: ::std::result::Result<::std::vec::Vec<super::TripInfo>, ::std::string::String>,
8822 }
8823
8824 impl ::std::default::Default for TripSegment {
8825 fn default() -> Self {
8826 Self {
8827 arrival: Err("no value supplied for arrival".to_string()),
8828 departure: Err("no value supplied for departure".to_string()),
8829 distance: Err("no value supplied for distance".to_string()),
8830 from: Err("no value supplied for from".to_string()),
8831 mode: Err("no value supplied for mode".to_string()),
8832 polyline: Err("no value supplied for polyline".to_string()),
8833 real_time: Err("no value supplied for real_time".to_string()),
8834 route_color: Ok(Default::default()),
8835 scheduled_arrival: Err("no value supplied for scheduled_arrival".to_string()),
8836 scheduled_departure: Err(
8837 "no value supplied for scheduled_departure".to_string()
8838 ),
8839 to: Err("no value supplied for to".to_string()),
8840 trips: Err("no value supplied for trips".to_string()),
8841 }
8842 }
8843 }
8844
8845 impl TripSegment {
8846 pub fn arrival<T>(mut self, value: T) -> Self
8847 where
8848 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
8849 T::Error: ::std::fmt::Display,
8850 {
8851 self.arrival = value
8852 .try_into()
8853 .map_err(|e| format!("error converting supplied value for arrival: {}", e));
8854 self
8855 }
8856 pub fn departure<T>(mut self, value: T) -> Self
8857 where
8858 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
8859 T::Error: ::std::fmt::Display,
8860 {
8861 self.departure = value
8862 .try_into()
8863 .map_err(|e| format!("error converting supplied value for departure: {}", e));
8864 self
8865 }
8866 pub fn distance<T>(mut self, value: T) -> Self
8867 where
8868 T: ::std::convert::TryInto<f64>,
8869 T::Error: ::std::fmt::Display,
8870 {
8871 self.distance = value
8872 .try_into()
8873 .map_err(|e| format!("error converting supplied value for distance: {}", e));
8874 self
8875 }
8876 pub fn from<T>(mut self, value: T) -> Self
8877 where
8878 T: ::std::convert::TryInto<super::Place>,
8879 T::Error: ::std::fmt::Display,
8880 {
8881 self.from = value
8882 .try_into()
8883 .map_err(|e| format!("error converting supplied value for from: {}", e));
8884 self
8885 }
8886 pub fn mode<T>(mut self, value: T) -> Self
8887 where
8888 T: ::std::convert::TryInto<super::Mode>,
8889 T::Error: ::std::fmt::Display,
8890 {
8891 self.mode = value
8892 .try_into()
8893 .map_err(|e| format!("error converting supplied value for mode: {}", e));
8894 self
8895 }
8896 pub fn polyline<T>(mut self, value: T) -> Self
8897 where
8898 T: ::std::convert::TryInto<::std::string::String>,
8899 T::Error: ::std::fmt::Display,
8900 {
8901 self.polyline = value
8902 .try_into()
8903 .map_err(|e| format!("error converting supplied value for polyline: {}", e));
8904 self
8905 }
8906 pub fn real_time<T>(mut self, value: T) -> Self
8907 where
8908 T: ::std::convert::TryInto<bool>,
8909 T::Error: ::std::fmt::Display,
8910 {
8911 self.real_time = value
8912 .try_into()
8913 .map_err(|e| format!("error converting supplied value for real_time: {}", e));
8914 self
8915 }
8916 pub fn route_color<T>(mut self, value: T) -> Self
8917 where
8918 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8919 T::Error: ::std::fmt::Display,
8920 {
8921 self.route_color = value
8922 .try_into()
8923 .map_err(|e| format!("error converting supplied value for route_color: {}", e));
8924 self
8925 }
8926 pub fn scheduled_arrival<T>(mut self, value: T) -> Self
8927 where
8928 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
8929 T::Error: ::std::fmt::Display,
8930 {
8931 self.scheduled_arrival = value.try_into().map_err(|e| {
8932 format!(
8933 "error converting supplied value for scheduled_arrival: {}",
8934 e
8935 )
8936 });
8937 self
8938 }
8939 pub fn scheduled_departure<T>(mut self, value: T) -> Self
8940 where
8941 T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
8942 T::Error: ::std::fmt::Display,
8943 {
8944 self.scheduled_departure = value.try_into().map_err(|e| {
8945 format!(
8946 "error converting supplied value for scheduled_departure: {}",
8947 e
8948 )
8949 });
8950 self
8951 }
8952 pub fn to<T>(mut self, value: T) -> Self
8953 where
8954 T: ::std::convert::TryInto<super::Place>,
8955 T::Error: ::std::fmt::Display,
8956 {
8957 self.to = value
8958 .try_into()
8959 .map_err(|e| format!("error converting supplied value for to: {}", e));
8960 self
8961 }
8962 pub fn trips<T>(mut self, value: T) -> Self
8963 where
8964 T: ::std::convert::TryInto<::std::vec::Vec<super::TripInfo>>,
8965 T::Error: ::std::fmt::Display,
8966 {
8967 self.trips = value
8968 .try_into()
8969 .map_err(|e| format!("error converting supplied value for trips: {}", e));
8970 self
8971 }
8972 }
8973
8974 impl ::std::convert::TryFrom<TripSegment> for super::TripSegment {
8975 type Error = super::error::ConversionError;
8976 fn try_from(
8977 value: TripSegment,
8978 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8979 Ok(Self {
8980 arrival: value.arrival?,
8981 departure: value.departure?,
8982 distance: value.distance?,
8983 from: value.from?,
8984 mode: value.mode?,
8985 polyline: value.polyline?,
8986 real_time: value.real_time?,
8987 route_color: value.route_color?,
8988 scheduled_arrival: value.scheduled_arrival?,
8989 scheduled_departure: value.scheduled_departure?,
8990 to: value.to?,
8991 trips: value.trips?,
8992 })
8993 }
8994 }
8995
8996 impl ::std::convert::From<super::TripSegment> for TripSegment {
8997 fn from(value: super::TripSegment) -> Self {
8998 Self {
8999 arrival: Ok(value.arrival),
9000 departure: Ok(value.departure),
9001 distance: Ok(value.distance),
9002 from: Ok(value.from),
9003 mode: Ok(value.mode),
9004 polyline: Ok(value.polyline),
9005 real_time: Ok(value.real_time),
9006 route_color: Ok(value.route_color),
9007 scheduled_arrival: Ok(value.scheduled_arrival),
9008 scheduled_departure: Ok(value.scheduled_departure),
9009 to: Ok(value.to),
9010 trips: Ok(value.trips),
9011 }
9012 }
9013 }
9014 }
9015}
9016
9017#[derive(Clone, Debug)]
9018pub struct Client {
9024 pub(crate) baseurl: String,
9025 pub(crate) client: reqwest::Client,
9026}
9027
9028impl Client {
9029 pub fn new(baseurl: &str) -> Self {
9035 #[cfg(not(target_arch = "wasm32"))]
9036 let client = {
9037 let dur = std::time::Duration::from_secs(15);
9038 reqwest::ClientBuilder::new()
9039 .connect_timeout(dur)
9040 .timeout(dur)
9041 };
9042 #[cfg(target_arch = "wasm32")]
9043 let client = reqwest::ClientBuilder::new();
9044 Self::new_with_client(baseurl, client.build().unwrap())
9045 }
9046
9047 pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
9054 Self {
9055 baseurl: baseurl.to_string(),
9056 client,
9057 }
9058 }
9059}
9060
9061impl ClientInfo<()> for Client {
9062 fn api_version() -> &'static str {
9063 "v4"
9064 }
9065
9066 fn baseurl(&self) -> &str {
9067 self.baseurl.as_str()
9068 }
9069
9070 fn client(&self) -> &reqwest::Client {
9071 &self.client
9072 }
9073
9074 fn inner(&self) -> &() {
9075 &()
9076 }
9077}
9078
9079impl ClientHooks<()> for &Client {}
9080impl Client {
9081 pub fn plan(&self) -> builder::Plan<'_> {
9530 builder::Plan::new(self)
9531 }
9532
9533 pub fn one_to_many(&self) -> builder::OneToMany<'_> {
9586 builder::OneToMany::new(self)
9587 }
9588
9589 pub fn one_to_all(&self) -> builder::OneToAll<'_> {
9754 builder::OneToAll::new(self)
9755 }
9756
9757 pub fn reverse_geocode(&self) -> builder::ReverseGeocode<'_> {
9777 builder::ReverseGeocode::new(self)
9778 }
9779
9780 pub fn geocode(&self) -> builder::Geocode<'_> {
9814 builder::Geocode::new(self)
9815 }
9816
9817 pub fn trip(&self) -> builder::Trip<'_> {
9848 builder::Trip::new(self)
9849 }
9850
9851 pub fn stoptimes(&self) -> builder::Stoptimes<'_> {
9931 builder::Stoptimes::new(self)
9932 }
9933
9934 pub fn trips(&self) -> builder::Trips<'_> {
9960 builder::Trips::new(self)
9961 }
9962
9963 pub fn initial(&self) -> builder::Initial<'_> {
9974 builder::Initial::new(self)
9975 }
9976
9977 pub fn stops(&self) -> builder::Stops<'_> {
9992 builder::Stops::new(self)
9993 }
9994
9995 pub fn levels(&self) -> builder::Levels<'_> {
10010 builder::Levels::new(self)
10011 }
10012
10013 pub fn transfers(&self) -> builder::Transfers<'_> {
10026 builder::Transfers::new(self)
10027 }
10028}
10029
10030#[allow(clippy::all)]
10032pub mod builder {
10033 use super::types;
10034 #[allow(unused_imports)]
10035 use super::{
10036 ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
10037 ResponseValue, encode_path,
10038 };
10039 #[derive(Debug, Clone)]
10043 pub struct Plan<'a> {
10044 client: &'a super::Client,
10045 additional_transfer_time: Result<Option<i64>, String>,
10046 algorithm: Result<Option<types::PlanAlgorithm>, String>,
10047 arrive_by: Result<Option<bool>, String>,
10048 detailed_transfers: Result<bool, String>,
10049 direct_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
10050 direct_rental_form_factors:
10051 Result<Option<::std::vec::Vec<types::RentalFormFactor>>, String>,
10052 direct_rental_propulsion_types:
10053 Result<Option<::std::vec::Vec<types::RentalPropulsionType>>, String>,
10054 direct_rental_providers: Result<Option<::std::vec::Vec<::std::string::String>>, String>,
10055 elevation_costs: Result<Option<types::ElevationCosts>, String>,
10056 fastest_direct_factor: Result<Option<f64>, String>,
10057 fastest_slow_direct_factor: Result<Option<f64>, String>,
10058 from_place: Result<::std::string::String, String>,
10059 ignore_direct_rental_return_constraints: Result<Option<bool>, String>,
10060 ignore_post_transit_rental_return_constraints: Result<Option<bool>, String>,
10061 ignore_pre_transit_rental_return_constraints: Result<Option<bool>, String>,
10062 join_interlined_legs: Result<Option<bool>, String>,
10063 language: Result<Option<::std::string::String>, String>,
10064 luggage: Result<Option<::std::num::NonZeroU64>, String>,
10065 max_direct_time: Result<Option<u64>, String>,
10066 max_matching_distance: Result<Option<f64>, String>,
10067 max_post_transit_time: Result<Option<u64>, String>,
10068 max_pre_transit_time: Result<Option<u64>, String>,
10069 max_transfers: Result<Option<i64>, String>,
10070 max_travel_time: Result<Option<i64>, String>,
10071 min_transfer_time: Result<Option<i64>, String>,
10072 num_itineraries: Result<Option<i64>, String>,
10073 page_cursor: Result<Option<::std::string::String>, String>,
10074 passengers: Result<Option<::std::num::NonZeroU64>, String>,
10075 pedestrian_profile: Result<Option<types::PedestrianProfile>, String>,
10076 post_transit_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
10077 post_transit_rental_form_factors:
10078 Result<Option<::std::vec::Vec<types::RentalFormFactor>>, String>,
10079 post_transit_rental_propulsion_types:
10080 Result<Option<::std::vec::Vec<types::RentalPropulsionType>>, String>,
10081 post_transit_rental_providers:
10082 Result<Option<::std::vec::Vec<::std::string::String>>, String>,
10083 pre_transit_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
10084 pre_transit_rental_form_factors:
10085 Result<Option<::std::vec::Vec<types::RentalFormFactor>>, String>,
10086 pre_transit_rental_propulsion_types:
10087 Result<Option<::std::vec::Vec<types::RentalPropulsionType>>, String>,
10088 pre_transit_rental_providers:
10089 Result<Option<::std::vec::Vec<::std::string::String>>, String>,
10090 require_bike_transport: Result<Option<bool>, String>,
10091 require_car_transport: Result<Option<bool>, String>,
10092 search_window: Result<Option<u64>, String>,
10093 slow_direct: Result<Option<bool>, String>,
10094 time: Result<Option<::chrono::DateTime<::chrono::offset::Utc>>, String>,
10095 timeout: Result<Option<u64>, String>,
10096 timetable_view: Result<Option<bool>, String>,
10097 to_place: Result<::std::string::String, String>,
10098 transfer_time_factor: Result<Option<f64>, String>,
10099 transit_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
10100 use_routed_transfers: Result<Option<bool>, String>,
10101 via: Result<Option<::std::vec::Vec<::std::string::String>>, String>,
10102 via_minimum_stay: Result<Option<::std::vec::Vec<i64>>, String>,
10103 with_fares: Result<Option<bool>, String>,
10104 with_scheduled_skipped_stops: Result<Option<bool>, String>,
10105 }
10106
10107 impl<'a> Plan<'a> {
10108 pub fn new(client: &'a super::Client) -> Self {
10109 Self {
10110 client: client,
10111 additional_transfer_time: Ok(None),
10112 algorithm: Ok(None),
10113 arrive_by: Ok(None),
10114 detailed_transfers: Err("detailed_transfers was not initialized".to_string()),
10115 direct_modes: Ok(None),
10116 direct_rental_form_factors: Ok(None),
10117 direct_rental_propulsion_types: Ok(None),
10118 direct_rental_providers: Ok(None),
10119 elevation_costs: Ok(None),
10120 fastest_direct_factor: Ok(None),
10121 fastest_slow_direct_factor: Ok(None),
10122 from_place: Err("from_place was not initialized".to_string()),
10123 ignore_direct_rental_return_constraints: Ok(None),
10124 ignore_post_transit_rental_return_constraints: Ok(None),
10125 ignore_pre_transit_rental_return_constraints: Ok(None),
10126 join_interlined_legs: Ok(None),
10127 language: Ok(None),
10128 luggage: Ok(None),
10129 max_direct_time: Ok(None),
10130 max_matching_distance: Ok(None),
10131 max_post_transit_time: Ok(None),
10132 max_pre_transit_time: Ok(None),
10133 max_transfers: Ok(None),
10134 max_travel_time: Ok(None),
10135 min_transfer_time: Ok(None),
10136 num_itineraries: Ok(None),
10137 page_cursor: Ok(None),
10138 passengers: Ok(None),
10139 pedestrian_profile: Ok(None),
10140 post_transit_modes: Ok(None),
10141 post_transit_rental_form_factors: Ok(None),
10142 post_transit_rental_propulsion_types: Ok(None),
10143 post_transit_rental_providers: Ok(None),
10144 pre_transit_modes: Ok(None),
10145 pre_transit_rental_form_factors: Ok(None),
10146 pre_transit_rental_propulsion_types: Ok(None),
10147 pre_transit_rental_providers: Ok(None),
10148 require_bike_transport: Ok(None),
10149 require_car_transport: Ok(None),
10150 search_window: Ok(None),
10151 slow_direct: Ok(None),
10152 time: Ok(None),
10153 timeout: Ok(None),
10154 timetable_view: Ok(None),
10155 to_place: Err("to_place was not initialized".to_string()),
10156 transfer_time_factor: Ok(None),
10157 transit_modes: Ok(None),
10158 use_routed_transfers: Ok(None),
10159 via: Ok(None),
10160 via_minimum_stay: Ok(None),
10161 with_fares: Ok(None),
10162 with_scheduled_skipped_stops: Ok(None),
10163 }
10164 }
10165
10166 pub fn additional_transfer_time<V>(mut self, value: V) -> Self
10167 where
10168 V: std::convert::TryInto<i64>,
10169 {
10170 self.additional_transfer_time = value
10171 .try_into()
10172 .map(Some)
10173 .map_err(|_| "conversion to `i64` for additional_transfer_time failed".to_string());
10174 self
10175 }
10176
10177 pub fn algorithm<V>(mut self, value: V) -> Self
10178 where
10179 V: std::convert::TryInto<types::PlanAlgorithm>,
10180 {
10181 self.algorithm = value
10182 .try_into()
10183 .map(Some)
10184 .map_err(|_| "conversion to `PlanAlgorithm` for algorithm failed".to_string());
10185 self
10186 }
10187
10188 pub fn arrive_by<V>(mut self, value: V) -> Self
10189 where
10190 V: std::convert::TryInto<bool>,
10191 {
10192 self.arrive_by = value
10193 .try_into()
10194 .map(Some)
10195 .map_err(|_| "conversion to `bool` for arrive_by failed".to_string());
10196 self
10197 }
10198
10199 pub fn detailed_transfers<V>(mut self, value: V) -> Self
10200 where
10201 V: std::convert::TryInto<bool>,
10202 {
10203 self.detailed_transfers = value
10204 .try_into()
10205 .map_err(|_| "conversion to `bool` for detailed_transfers failed".to_string());
10206 self
10207 }
10208
10209 pub fn direct_modes<V>(mut self, value: V) -> Self
10210 where
10211 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
10212 {
10213 self.direct_modes = value.try_into().map(Some).map_err(|_| {
10214 "conversion to `:: std :: vec :: Vec < Mode >` for direct_modes failed".to_string()
10215 });
10216 self
10217 }
10218
10219 pub fn direct_rental_form_factors<V>(mut self, value: V) -> Self
10220 where
10221 V: std::convert::TryInto<::std::vec::Vec<types::RentalFormFactor>>,
10222 {
10223 self . direct_rental_form_factors = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < RentalFormFactor >` for direct_rental_form_factors failed" . to_string ()) ;
10224 self
10225 }
10226
10227 pub fn direct_rental_propulsion_types<V>(mut self, value: V) -> Self
10228 where
10229 V: std::convert::TryInto<::std::vec::Vec<types::RentalPropulsionType>>,
10230 {
10231 self . direct_rental_propulsion_types = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < RentalPropulsionType >` for direct_rental_propulsion_types failed" . to_string ()) ;
10232 self
10233 }
10234
10235 pub fn direct_rental_providers<V>(mut self, value: V) -> Self
10236 where
10237 V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
10238 {
10239 self . direct_rental_providers = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for direct_rental_providers failed" . to_string ()) ;
10240 self
10241 }
10242
10243 pub fn elevation_costs<V>(mut self, value: V) -> Self
10244 where
10245 V: std::convert::TryInto<types::ElevationCosts>,
10246 {
10247 self.elevation_costs = value.try_into().map(Some).map_err(|_| {
10248 "conversion to `ElevationCosts` for elevation_costs failed".to_string()
10249 });
10250 self
10251 }
10252
10253 pub fn fastest_direct_factor<V>(mut self, value: V) -> Self
10254 where
10255 V: std::convert::TryInto<f64>,
10256 {
10257 self.fastest_direct_factor = value
10258 .try_into()
10259 .map(Some)
10260 .map_err(|_| "conversion to `f64` for fastest_direct_factor failed".to_string());
10261 self
10262 }
10263
10264 pub fn fastest_slow_direct_factor<V>(mut self, value: V) -> Self
10265 where
10266 V: std::convert::TryInto<f64>,
10267 {
10268 self.fastest_slow_direct_factor = value.try_into().map(Some).map_err(|_| {
10269 "conversion to `f64` for fastest_slow_direct_factor failed".to_string()
10270 });
10271 self
10272 }
10273
10274 pub fn from_place<V>(mut self, value: V) -> Self
10275 where
10276 V: std::convert::TryInto<::std::string::String>,
10277 {
10278 self.from_place = value.try_into().map_err(|_| {
10279 "conversion to `:: std :: string :: String` for from_place failed".to_string()
10280 });
10281 self
10282 }
10283
10284 pub fn ignore_direct_rental_return_constraints<V>(mut self, value: V) -> Self
10285 where
10286 V: std::convert::TryInto<bool>,
10287 {
10288 self.ignore_direct_rental_return_constraints =
10289 value.try_into().map(Some).map_err(|_| {
10290 "conversion to `bool` for ignore_direct_rental_return_constraints failed"
10291 .to_string()
10292 });
10293 self
10294 }
10295
10296 pub fn ignore_post_transit_rental_return_constraints<V>(mut self, value: V) -> Self
10297 where
10298 V: std::convert::TryInto<bool>,
10299 {
10300 self.ignore_post_transit_rental_return_constraints =
10301 value.try_into().map(Some).map_err(|_| {
10302 "conversion to `bool` for ignore_post_transit_rental_return_constraints failed"
10303 .to_string()
10304 });
10305 self
10306 }
10307
10308 pub fn ignore_pre_transit_rental_return_constraints<V>(mut self, value: V) -> Self
10309 where
10310 V: std::convert::TryInto<bool>,
10311 {
10312 self.ignore_pre_transit_rental_return_constraints =
10313 value.try_into().map(Some).map_err(|_| {
10314 "conversion to `bool` for ignore_pre_transit_rental_return_constraints failed"
10315 .to_string()
10316 });
10317 self
10318 }
10319
10320 pub fn join_interlined_legs<V>(mut self, value: V) -> Self
10321 where
10322 V: std::convert::TryInto<bool>,
10323 {
10324 self.join_interlined_legs = value
10325 .try_into()
10326 .map(Some)
10327 .map_err(|_| "conversion to `bool` for join_interlined_legs failed".to_string());
10328 self
10329 }
10330
10331 pub fn language<V>(mut self, value: V) -> Self
10332 where
10333 V: std::convert::TryInto<::std::string::String>,
10334 {
10335 self.language = value.try_into().map(Some).map_err(|_| {
10336 "conversion to `:: std :: string :: String` for language failed".to_string()
10337 });
10338 self
10339 }
10340
10341 pub fn luggage<V>(mut self, value: V) -> Self
10342 where
10343 V: std::convert::TryInto<::std::num::NonZeroU64>,
10344 {
10345 self.luggage = value.try_into().map(Some).map_err(|_| {
10346 "conversion to `:: std :: num :: NonZeroU64` for luggage failed".to_string()
10347 });
10348 self
10349 }
10350
10351 pub fn max_direct_time<V>(mut self, value: V) -> Self
10352 where
10353 V: std::convert::TryInto<u64>,
10354 {
10355 self.max_direct_time = value
10356 .try_into()
10357 .map(Some)
10358 .map_err(|_| "conversion to `u64` for max_direct_time failed".to_string());
10359 self
10360 }
10361
10362 pub fn max_matching_distance<V>(mut self, value: V) -> Self
10363 where
10364 V: std::convert::TryInto<f64>,
10365 {
10366 self.max_matching_distance = value
10367 .try_into()
10368 .map(Some)
10369 .map_err(|_| "conversion to `f64` for max_matching_distance failed".to_string());
10370 self
10371 }
10372
10373 pub fn max_post_transit_time<V>(mut self, value: V) -> Self
10374 where
10375 V: std::convert::TryInto<u64>,
10376 {
10377 self.max_post_transit_time = value
10378 .try_into()
10379 .map(Some)
10380 .map_err(|_| "conversion to `u64` for max_post_transit_time failed".to_string());
10381 self
10382 }
10383
10384 pub fn max_pre_transit_time<V>(mut self, value: V) -> Self
10385 where
10386 V: std::convert::TryInto<u64>,
10387 {
10388 self.max_pre_transit_time = value
10389 .try_into()
10390 .map(Some)
10391 .map_err(|_| "conversion to `u64` for max_pre_transit_time failed".to_string());
10392 self
10393 }
10394
10395 pub fn max_transfers<V>(mut self, value: V) -> Self
10396 where
10397 V: std::convert::TryInto<i64>,
10398 {
10399 self.max_transfers = value
10400 .try_into()
10401 .map(Some)
10402 .map_err(|_| "conversion to `i64` for max_transfers failed".to_string());
10403 self
10404 }
10405
10406 pub fn max_travel_time<V>(mut self, value: V) -> Self
10407 where
10408 V: std::convert::TryInto<i64>,
10409 {
10410 self.max_travel_time = value
10411 .try_into()
10412 .map(Some)
10413 .map_err(|_| "conversion to `i64` for max_travel_time failed".to_string());
10414 self
10415 }
10416
10417 pub fn min_transfer_time<V>(mut self, value: V) -> Self
10418 where
10419 V: std::convert::TryInto<i64>,
10420 {
10421 self.min_transfer_time = value
10422 .try_into()
10423 .map(Some)
10424 .map_err(|_| "conversion to `i64` for min_transfer_time failed".to_string());
10425 self
10426 }
10427
10428 pub fn num_itineraries<V>(mut self, value: V) -> Self
10429 where
10430 V: std::convert::TryInto<i64>,
10431 {
10432 self.num_itineraries = value
10433 .try_into()
10434 .map(Some)
10435 .map_err(|_| "conversion to `i64` for num_itineraries failed".to_string());
10436 self
10437 }
10438
10439 pub fn page_cursor<V>(mut self, value: V) -> Self
10440 where
10441 V: std::convert::TryInto<::std::string::String>,
10442 {
10443 self.page_cursor = value.try_into().map(Some).map_err(|_| {
10444 "conversion to `:: std :: string :: String` for page_cursor failed".to_string()
10445 });
10446 self
10447 }
10448
10449 pub fn passengers<V>(mut self, value: V) -> Self
10450 where
10451 V: std::convert::TryInto<::std::num::NonZeroU64>,
10452 {
10453 self.passengers = value.try_into().map(Some).map_err(|_| {
10454 "conversion to `:: std :: num :: NonZeroU64` for passengers failed".to_string()
10455 });
10456 self
10457 }
10458
10459 pub fn pedestrian_profile<V>(mut self, value: V) -> Self
10460 where
10461 V: std::convert::TryInto<types::PedestrianProfile>,
10462 {
10463 self.pedestrian_profile = value.try_into().map(Some).map_err(|_| {
10464 "conversion to `PedestrianProfile` for pedestrian_profile failed".to_string()
10465 });
10466 self
10467 }
10468
10469 pub fn post_transit_modes<V>(mut self, value: V) -> Self
10470 where
10471 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
10472 {
10473 self.post_transit_modes = value.try_into().map(Some).map_err(|_| {
10474 "conversion to `:: std :: vec :: Vec < Mode >` for post_transit_modes failed"
10475 .to_string()
10476 });
10477 self
10478 }
10479
10480 pub fn post_transit_rental_form_factors<V>(mut self, value: V) -> Self
10481 where
10482 V: std::convert::TryInto<::std::vec::Vec<types::RentalFormFactor>>,
10483 {
10484 self . post_transit_rental_form_factors = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < RentalFormFactor >` for post_transit_rental_form_factors failed" . to_string ()) ;
10485 self
10486 }
10487
10488 pub fn post_transit_rental_propulsion_types<V>(mut self, value: V) -> Self
10489 where
10490 V: std::convert::TryInto<::std::vec::Vec<types::RentalPropulsionType>>,
10491 {
10492 self . post_transit_rental_propulsion_types = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < RentalPropulsionType >` for post_transit_rental_propulsion_types failed" . to_string ()) ;
10493 self
10494 }
10495
10496 pub fn post_transit_rental_providers<V>(mut self, value: V) -> Self
10497 where
10498 V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
10499 {
10500 self . post_transit_rental_providers = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for post_transit_rental_providers failed" . to_string ()) ;
10501 self
10502 }
10503
10504 pub fn pre_transit_modes<V>(mut self, value: V) -> Self
10505 where
10506 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
10507 {
10508 self.pre_transit_modes = value.try_into().map(Some).map_err(|_| {
10509 "conversion to `:: std :: vec :: Vec < Mode >` for pre_transit_modes failed"
10510 .to_string()
10511 });
10512 self
10513 }
10514
10515 pub fn pre_transit_rental_form_factors<V>(mut self, value: V) -> Self
10516 where
10517 V: std::convert::TryInto<::std::vec::Vec<types::RentalFormFactor>>,
10518 {
10519 self . pre_transit_rental_form_factors = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < RentalFormFactor >` for pre_transit_rental_form_factors failed" . to_string ()) ;
10520 self
10521 }
10522
10523 pub fn pre_transit_rental_propulsion_types<V>(mut self, value: V) -> Self
10524 where
10525 V: std::convert::TryInto<::std::vec::Vec<types::RentalPropulsionType>>,
10526 {
10527 self . pre_transit_rental_propulsion_types = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < RentalPropulsionType >` for pre_transit_rental_propulsion_types failed" . to_string ()) ;
10528 self
10529 }
10530
10531 pub fn pre_transit_rental_providers<V>(mut self, value: V) -> Self
10532 where
10533 V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
10534 {
10535 self . pre_transit_rental_providers = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for pre_transit_rental_providers failed" . to_string ()) ;
10536 self
10537 }
10538
10539 pub fn require_bike_transport<V>(mut self, value: V) -> Self
10540 where
10541 V: std::convert::TryInto<bool>,
10542 {
10543 self.require_bike_transport = value
10544 .try_into()
10545 .map(Some)
10546 .map_err(|_| "conversion to `bool` for require_bike_transport failed".to_string());
10547 self
10548 }
10549
10550 pub fn require_car_transport<V>(mut self, value: V) -> Self
10551 where
10552 V: std::convert::TryInto<bool>,
10553 {
10554 self.require_car_transport = value
10555 .try_into()
10556 .map(Some)
10557 .map_err(|_| "conversion to `bool` for require_car_transport failed".to_string());
10558 self
10559 }
10560
10561 pub fn search_window<V>(mut self, value: V) -> Self
10562 where
10563 V: std::convert::TryInto<u64>,
10564 {
10565 self.search_window = value
10566 .try_into()
10567 .map(Some)
10568 .map_err(|_| "conversion to `u64` for search_window failed".to_string());
10569 self
10570 }
10571
10572 pub fn slow_direct<V>(mut self, value: V) -> Self
10573 where
10574 V: std::convert::TryInto<bool>,
10575 {
10576 self.slow_direct = value
10577 .try_into()
10578 .map(Some)
10579 .map_err(|_| "conversion to `bool` for slow_direct failed".to_string());
10580 self
10581 }
10582
10583 pub fn time<V>(mut self, value: V) -> Self
10584 where
10585 V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
10586 {
10587 self . time = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for time failed" . to_string ()) ;
10588 self
10589 }
10590
10591 pub fn timeout<V>(mut self, value: V) -> Self
10592 where
10593 V: std::convert::TryInto<u64>,
10594 {
10595 self.timeout = value
10596 .try_into()
10597 .map(Some)
10598 .map_err(|_| "conversion to `u64` for timeout failed".to_string());
10599 self
10600 }
10601
10602 pub fn timetable_view<V>(mut self, value: V) -> Self
10603 where
10604 V: std::convert::TryInto<bool>,
10605 {
10606 self.timetable_view = value
10607 .try_into()
10608 .map(Some)
10609 .map_err(|_| "conversion to `bool` for timetable_view failed".to_string());
10610 self
10611 }
10612
10613 pub fn to_place<V>(mut self, value: V) -> Self
10614 where
10615 V: std::convert::TryInto<::std::string::String>,
10616 {
10617 self.to_place = value.try_into().map_err(|_| {
10618 "conversion to `:: std :: string :: String` for to_place failed".to_string()
10619 });
10620 self
10621 }
10622
10623 pub fn transfer_time_factor<V>(mut self, value: V) -> Self
10624 where
10625 V: std::convert::TryInto<f64>,
10626 {
10627 self.transfer_time_factor = value
10628 .try_into()
10629 .map(Some)
10630 .map_err(|_| "conversion to `f64` for transfer_time_factor failed".to_string());
10631 self
10632 }
10633
10634 pub fn transit_modes<V>(mut self, value: V) -> Self
10635 where
10636 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
10637 {
10638 self.transit_modes = value.try_into().map(Some).map_err(|_| {
10639 "conversion to `:: std :: vec :: Vec < Mode >` for transit_modes failed".to_string()
10640 });
10641 self
10642 }
10643
10644 pub fn use_routed_transfers<V>(mut self, value: V) -> Self
10645 where
10646 V: std::convert::TryInto<bool>,
10647 {
10648 self.use_routed_transfers = value
10649 .try_into()
10650 .map(Some)
10651 .map_err(|_| "conversion to `bool` for use_routed_transfers failed".to_string());
10652 self
10653 }
10654
10655 pub fn via<V>(mut self, value: V) -> Self
10656 where
10657 V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
10658 {
10659 self . via = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for via failed" . to_string ()) ;
10660 self
10661 }
10662
10663 pub fn via_minimum_stay<V>(mut self, value: V) -> Self
10664 where
10665 V: std::convert::TryInto<::std::vec::Vec<i64>>,
10666 {
10667 self.via_minimum_stay = value.try_into().map(Some).map_err(|_| {
10668 "conversion to `:: std :: vec :: Vec < i64 >` for via_minimum_stay failed"
10669 .to_string()
10670 });
10671 self
10672 }
10673
10674 pub fn with_fares<V>(mut self, value: V) -> Self
10675 where
10676 V: std::convert::TryInto<bool>,
10677 {
10678 self.with_fares = value
10679 .try_into()
10680 .map(Some)
10681 .map_err(|_| "conversion to `bool` for with_fares failed".to_string());
10682 self
10683 }
10684
10685 pub fn with_scheduled_skipped_stops<V>(mut self, value: V) -> Self
10686 where
10687 V: std::convert::TryInto<bool>,
10688 {
10689 self.with_scheduled_skipped_stops = value.try_into().map(Some).map_err(|_| {
10690 "conversion to `bool` for with_scheduled_skipped_stops failed".to_string()
10691 });
10692 self
10693 }
10694
10695 pub async fn send(self) -> Result<ResponseValue<types::PlanResponse>, Error<()>> {
10697 let Self {
10698 client,
10699 additional_transfer_time,
10700 algorithm,
10701 arrive_by,
10702 detailed_transfers,
10703 direct_modes,
10704 direct_rental_form_factors,
10705 direct_rental_propulsion_types,
10706 direct_rental_providers,
10707 elevation_costs,
10708 fastest_direct_factor,
10709 fastest_slow_direct_factor,
10710 from_place,
10711 ignore_direct_rental_return_constraints,
10712 ignore_post_transit_rental_return_constraints,
10713 ignore_pre_transit_rental_return_constraints,
10714 join_interlined_legs,
10715 language,
10716 luggage,
10717 max_direct_time,
10718 max_matching_distance,
10719 max_post_transit_time,
10720 max_pre_transit_time,
10721 max_transfers,
10722 max_travel_time,
10723 min_transfer_time,
10724 num_itineraries,
10725 page_cursor,
10726 passengers,
10727 pedestrian_profile,
10728 post_transit_modes,
10729 post_transit_rental_form_factors,
10730 post_transit_rental_propulsion_types,
10731 post_transit_rental_providers,
10732 pre_transit_modes,
10733 pre_transit_rental_form_factors,
10734 pre_transit_rental_propulsion_types,
10735 pre_transit_rental_providers,
10736 require_bike_transport,
10737 require_car_transport,
10738 search_window,
10739 slow_direct,
10740 time,
10741 timeout,
10742 timetable_view,
10743 to_place,
10744 transfer_time_factor,
10745 transit_modes,
10746 use_routed_transfers,
10747 via,
10748 via_minimum_stay,
10749 with_fares,
10750 with_scheduled_skipped_stops,
10751 } = self;
10752 let additional_transfer_time =
10753 additional_transfer_time.map_err(Error::InvalidRequest)?;
10754 let algorithm = algorithm.map_err(Error::InvalidRequest)?;
10755 let arrive_by = arrive_by.map_err(Error::InvalidRequest)?;
10756 let detailed_transfers = detailed_transfers.map_err(Error::InvalidRequest)?;
10757 let direct_modes = direct_modes.map_err(Error::InvalidRequest)?;
10758 let direct_rental_form_factors =
10759 direct_rental_form_factors.map_err(Error::InvalidRequest)?;
10760 let direct_rental_propulsion_types =
10761 direct_rental_propulsion_types.map_err(Error::InvalidRequest)?;
10762 let direct_rental_providers = direct_rental_providers.map_err(Error::InvalidRequest)?;
10763 let elevation_costs = elevation_costs.map_err(Error::InvalidRequest)?;
10764 let fastest_direct_factor = fastest_direct_factor.map_err(Error::InvalidRequest)?;
10765 let fastest_slow_direct_factor =
10766 fastest_slow_direct_factor.map_err(Error::InvalidRequest)?;
10767 let from_place = from_place.map_err(Error::InvalidRequest)?;
10768 let ignore_direct_rental_return_constraints =
10769 ignore_direct_rental_return_constraints.map_err(Error::InvalidRequest)?;
10770 let ignore_post_transit_rental_return_constraints =
10771 ignore_post_transit_rental_return_constraints.map_err(Error::InvalidRequest)?;
10772 let ignore_pre_transit_rental_return_constraints =
10773 ignore_pre_transit_rental_return_constraints.map_err(Error::InvalidRequest)?;
10774 let join_interlined_legs = join_interlined_legs.map_err(Error::InvalidRequest)?;
10775 let language = language.map_err(Error::InvalidRequest)?;
10776 let luggage = luggage.map_err(Error::InvalidRequest)?;
10777 let max_direct_time = max_direct_time.map_err(Error::InvalidRequest)?;
10778 let max_matching_distance = max_matching_distance.map_err(Error::InvalidRequest)?;
10779 let max_post_transit_time = max_post_transit_time.map_err(Error::InvalidRequest)?;
10780 let max_pre_transit_time = max_pre_transit_time.map_err(Error::InvalidRequest)?;
10781 let max_transfers = max_transfers.map_err(Error::InvalidRequest)?;
10782 let max_travel_time = max_travel_time.map_err(Error::InvalidRequest)?;
10783 let min_transfer_time = min_transfer_time.map_err(Error::InvalidRequest)?;
10784 let num_itineraries = num_itineraries.map_err(Error::InvalidRequest)?;
10785 let page_cursor = page_cursor.map_err(Error::InvalidRequest)?;
10786 let passengers = passengers.map_err(Error::InvalidRequest)?;
10787 let pedestrian_profile = pedestrian_profile.map_err(Error::InvalidRequest)?;
10788 let post_transit_modes = post_transit_modes.map_err(Error::InvalidRequest)?;
10789 let post_transit_rental_form_factors =
10790 post_transit_rental_form_factors.map_err(Error::InvalidRequest)?;
10791 let post_transit_rental_propulsion_types =
10792 post_transit_rental_propulsion_types.map_err(Error::InvalidRequest)?;
10793 let post_transit_rental_providers =
10794 post_transit_rental_providers.map_err(Error::InvalidRequest)?;
10795 let pre_transit_modes = pre_transit_modes.map_err(Error::InvalidRequest)?;
10796 let pre_transit_rental_form_factors =
10797 pre_transit_rental_form_factors.map_err(Error::InvalidRequest)?;
10798 let pre_transit_rental_propulsion_types =
10799 pre_transit_rental_propulsion_types.map_err(Error::InvalidRequest)?;
10800 let pre_transit_rental_providers =
10801 pre_transit_rental_providers.map_err(Error::InvalidRequest)?;
10802 let require_bike_transport = require_bike_transport.map_err(Error::InvalidRequest)?;
10803 let require_car_transport = require_car_transport.map_err(Error::InvalidRequest)?;
10804 let search_window = search_window.map_err(Error::InvalidRequest)?;
10805 let slow_direct = slow_direct.map_err(Error::InvalidRequest)?;
10806 let time = time.map_err(Error::InvalidRequest)?;
10807 let timeout = timeout.map_err(Error::InvalidRequest)?;
10808 let timetable_view = timetable_view.map_err(Error::InvalidRequest)?;
10809 let to_place = to_place.map_err(Error::InvalidRequest)?;
10810 let transfer_time_factor = transfer_time_factor.map_err(Error::InvalidRequest)?;
10811 let transit_modes = transit_modes.map_err(Error::InvalidRequest)?;
10812 let use_routed_transfers = use_routed_transfers.map_err(Error::InvalidRequest)?;
10813 let via = via.map_err(Error::InvalidRequest)?;
10814 let via_minimum_stay = via_minimum_stay.map_err(Error::InvalidRequest)?;
10815 let with_fares = with_fares.map_err(Error::InvalidRequest)?;
10816 let with_scheduled_skipped_stops =
10817 with_scheduled_skipped_stops.map_err(Error::InvalidRequest)?;
10818 let url = format!("{}/api/v4/plan", client.baseurl,);
10819 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
10820 header_map.append(
10821 ::reqwest::header::HeaderName::from_static("api-version"),
10822 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
10823 );
10824 #[allow(unused_mut)]
10825 let mut request = client
10826 .client
10827 .get(url)
10828 .header(
10829 ::reqwest::header::ACCEPT,
10830 ::reqwest::header::HeaderValue::from_static("application/json"),
10831 )
10832 .query(&progenitor_client::QueryParam::new(
10833 "additionalTransferTime",
10834 &additional_transfer_time,
10835 ))
10836 .query(&progenitor_client::QueryParam::new("algorithm", &algorithm))
10837 .query(&progenitor_client::QueryParam::new("arriveBy", &arrive_by))
10838 .query(&progenitor_client::QueryParam::new(
10839 "detailedTransfers",
10840 &detailed_transfers,
10841 ))
10842 .query(&progenitor_client::QueryParam::new(
10843 "directModes",
10844 &direct_modes,
10845 ))
10846 .query(&progenitor_client::QueryParam::new(
10847 "directRentalFormFactors",
10848 &direct_rental_form_factors,
10849 ))
10850 .query(&progenitor_client::QueryParam::new(
10851 "directRentalPropulsionTypes",
10852 &direct_rental_propulsion_types,
10853 ))
10854 .query(&progenitor_client::QueryParam::new(
10855 "directRentalProviders",
10856 &direct_rental_providers,
10857 ))
10858 .query(&progenitor_client::QueryParam::new(
10859 "elevationCosts",
10860 &elevation_costs,
10861 ))
10862 .query(&progenitor_client::QueryParam::new(
10863 "fastestDirectFactor",
10864 &fastest_direct_factor,
10865 ))
10866 .query(&progenitor_client::QueryParam::new(
10867 "fastestSlowDirectFactor",
10868 &fastest_slow_direct_factor,
10869 ))
10870 .query(&progenitor_client::QueryParam::new(
10871 "fromPlace",
10872 &from_place,
10873 ))
10874 .query(&progenitor_client::QueryParam::new(
10875 "ignoreDirectRentalReturnConstraints",
10876 &ignore_direct_rental_return_constraints,
10877 ))
10878 .query(&progenitor_client::QueryParam::new(
10879 "ignorePostTransitRentalReturnConstraints",
10880 &ignore_post_transit_rental_return_constraints,
10881 ))
10882 .query(&progenitor_client::QueryParam::new(
10883 "ignorePreTransitRentalReturnConstraints",
10884 &ignore_pre_transit_rental_return_constraints,
10885 ))
10886 .query(&progenitor_client::QueryParam::new(
10887 "joinInterlinedLegs",
10888 &join_interlined_legs,
10889 ))
10890 .query(&progenitor_client::QueryParam::new("language", &language))
10891 .query(&progenitor_client::QueryParam::new("luggage", &luggage))
10892 .query(&progenitor_client::QueryParam::new(
10893 "maxDirectTime",
10894 &max_direct_time,
10895 ))
10896 .query(&progenitor_client::QueryParam::new(
10897 "maxMatchingDistance",
10898 &max_matching_distance,
10899 ))
10900 .query(&progenitor_client::QueryParam::new(
10901 "maxPostTransitTime",
10902 &max_post_transit_time,
10903 ))
10904 .query(&progenitor_client::QueryParam::new(
10905 "maxPreTransitTime",
10906 &max_pre_transit_time,
10907 ))
10908 .query(&progenitor_client::QueryParam::new(
10909 "maxTransfers",
10910 &max_transfers,
10911 ))
10912 .query(&progenitor_client::QueryParam::new(
10913 "maxTravelTime",
10914 &max_travel_time,
10915 ))
10916 .query(&progenitor_client::QueryParam::new(
10917 "minTransferTime",
10918 &min_transfer_time,
10919 ))
10920 .query(&progenitor_client::QueryParam::new(
10921 "numItineraries",
10922 &num_itineraries,
10923 ))
10924 .query(&progenitor_client::QueryParam::new(
10925 "pageCursor",
10926 &page_cursor,
10927 ))
10928 .query(&progenitor_client::QueryParam::new(
10929 "passengers",
10930 &passengers,
10931 ))
10932 .query(&progenitor_client::QueryParam::new(
10933 "pedestrianProfile",
10934 &pedestrian_profile,
10935 ))
10936 .query(&progenitor_client::QueryParam::new(
10937 "postTransitModes",
10938 &post_transit_modes,
10939 ))
10940 .query(&progenitor_client::QueryParam::new(
10941 "postTransitRentalFormFactors",
10942 &post_transit_rental_form_factors,
10943 ))
10944 .query(&progenitor_client::QueryParam::new(
10945 "postTransitRentalPropulsionTypes",
10946 &post_transit_rental_propulsion_types,
10947 ))
10948 .query(&progenitor_client::QueryParam::new(
10949 "postTransitRentalProviders",
10950 &post_transit_rental_providers,
10951 ))
10952 .query(&progenitor_client::QueryParam::new(
10953 "preTransitModes",
10954 &pre_transit_modes,
10955 ))
10956 .query(&progenitor_client::QueryParam::new(
10957 "preTransitRentalFormFactors",
10958 &pre_transit_rental_form_factors,
10959 ))
10960 .query(&progenitor_client::QueryParam::new(
10961 "preTransitRentalPropulsionTypes",
10962 &pre_transit_rental_propulsion_types,
10963 ))
10964 .query(&progenitor_client::QueryParam::new(
10965 "preTransitRentalProviders",
10966 &pre_transit_rental_providers,
10967 ))
10968 .query(&progenitor_client::QueryParam::new(
10969 "requireBikeTransport",
10970 &require_bike_transport,
10971 ))
10972 .query(&progenitor_client::QueryParam::new(
10973 "requireCarTransport",
10974 &require_car_transport,
10975 ))
10976 .query(&progenitor_client::QueryParam::new(
10977 "searchWindow",
10978 &search_window,
10979 ))
10980 .query(&progenitor_client::QueryParam::new(
10981 "slowDirect",
10982 &slow_direct,
10983 ))
10984 .query(&progenitor_client::QueryParam::new("time", &time))
10985 .query(&progenitor_client::QueryParam::new("timeout", &timeout))
10986 .query(&progenitor_client::QueryParam::new(
10987 "timetableView",
10988 &timetable_view,
10989 ))
10990 .query(&progenitor_client::QueryParam::new("toPlace", &to_place))
10991 .query(&progenitor_client::QueryParam::new(
10992 "transferTimeFactor",
10993 &transfer_time_factor,
10994 ))
10995 .query(&progenitor_client::QueryParam::new(
10996 "transitModes",
10997 &transit_modes,
10998 ))
10999 .query(&progenitor_client::QueryParam::new(
11000 "useRoutedTransfers",
11001 &use_routed_transfers,
11002 ))
11003 .query(&progenitor_client::QueryParam::new("via", &via))
11004 .query(&progenitor_client::QueryParam::new(
11005 "viaMinimumStay",
11006 &via_minimum_stay,
11007 ))
11008 .query(&progenitor_client::QueryParam::new(
11009 "withFares",
11010 &with_fares,
11011 ))
11012 .query(&progenitor_client::QueryParam::new(
11013 "withScheduledSkippedStops",
11014 &with_scheduled_skipped_stops,
11015 ))
11016 .headers(header_map)
11017 .build()?;
11018 let info = OperationInfo {
11019 operation_id: "plan",
11020 };
11021 client.pre(&mut request, &info).await?;
11022 let result = client.exec(request, &info).await;
11023 client.post(&result, &info).await?;
11024 let response = result?;
11025 match response.status().as_u16() {
11026 200u16 => ResponseValue::from_response(response).await,
11027 _ => Err(Error::UnexpectedResponse(response)),
11028 }
11029 }
11030 }
11031
11032 #[derive(Debug, Clone)]
11036 pub struct OneToMany<'a> {
11037 client: &'a super::Client,
11038 arrive_by: Result<bool, String>,
11039 elevation_costs: Result<Option<types::ElevationCosts>, String>,
11040 many: Result<::std::vec::Vec<::std::string::String>, String>,
11041 max: Result<f64, String>,
11042 max_matching_distance: Result<f64, String>,
11043 mode: Result<types::Mode, String>,
11044 one: Result<::std::string::String, String>,
11045 }
11046
11047 impl<'a> OneToMany<'a> {
11048 pub fn new(client: &'a super::Client) -> Self {
11049 Self {
11050 client: client,
11051 arrive_by: Err("arrive_by was not initialized".to_string()),
11052 elevation_costs: Ok(None),
11053 many: Err("many was not initialized".to_string()),
11054 max: Err("max was not initialized".to_string()),
11055 max_matching_distance: Err("max_matching_distance was not initialized".to_string()),
11056 mode: Err("mode was not initialized".to_string()),
11057 one: Err("one was not initialized".to_string()),
11058 }
11059 }
11060
11061 pub fn arrive_by<V>(mut self, value: V) -> Self
11062 where
11063 V: std::convert::TryInto<bool>,
11064 {
11065 self.arrive_by = value
11066 .try_into()
11067 .map_err(|_| "conversion to `bool` for arrive_by failed".to_string());
11068 self
11069 }
11070
11071 pub fn elevation_costs<V>(mut self, value: V) -> Self
11072 where
11073 V: std::convert::TryInto<types::ElevationCosts>,
11074 {
11075 self.elevation_costs = value.try_into().map(Some).map_err(|_| {
11076 "conversion to `ElevationCosts` for elevation_costs failed".to_string()
11077 });
11078 self
11079 }
11080
11081 pub fn many<V>(mut self, value: V) -> Self
11082 where
11083 V: std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
11084 {
11085 self . many = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < :: std :: string :: String >` for many failed" . to_string ()) ;
11086 self
11087 }
11088
11089 pub fn max<V>(mut self, value: V) -> Self
11090 where
11091 V: std::convert::TryInto<f64>,
11092 {
11093 self.max = value
11094 .try_into()
11095 .map_err(|_| "conversion to `f64` for max failed".to_string());
11096 self
11097 }
11098
11099 pub fn max_matching_distance<V>(mut self, value: V) -> Self
11100 where
11101 V: std::convert::TryInto<f64>,
11102 {
11103 self.max_matching_distance = value
11104 .try_into()
11105 .map_err(|_| "conversion to `f64` for max_matching_distance failed".to_string());
11106 self
11107 }
11108
11109 pub fn mode<V>(mut self, value: V) -> Self
11110 where
11111 V: std::convert::TryInto<types::Mode>,
11112 {
11113 self.mode = value
11114 .try_into()
11115 .map_err(|_| "conversion to `Mode` for mode failed".to_string());
11116 self
11117 }
11118
11119 pub fn one<V>(mut self, value: V) -> Self
11120 where
11121 V: std::convert::TryInto<::std::string::String>,
11122 {
11123 self.one = value.try_into().map_err(|_| {
11124 "conversion to `:: std :: string :: String` for one failed".to_string()
11125 });
11126 self
11127 }
11128
11129 pub async fn send(
11131 self,
11132 ) -> Result<ResponseValue<::std::vec::Vec<types::Duration>>, Error<()>> {
11133 let Self {
11134 client,
11135 arrive_by,
11136 elevation_costs,
11137 many,
11138 max,
11139 max_matching_distance,
11140 mode,
11141 one,
11142 } = self;
11143 let arrive_by = arrive_by.map_err(Error::InvalidRequest)?;
11144 let elevation_costs = elevation_costs.map_err(Error::InvalidRequest)?;
11145 let many = many.map_err(Error::InvalidRequest)?;
11146 let max = max.map_err(Error::InvalidRequest)?;
11147 let max_matching_distance = max_matching_distance.map_err(Error::InvalidRequest)?;
11148 let mode = mode.map_err(Error::InvalidRequest)?;
11149 let one = one.map_err(Error::InvalidRequest)?;
11150 let url = format!("{}/api/v1/one-to-many", client.baseurl,);
11151 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
11152 header_map.append(
11153 ::reqwest::header::HeaderName::from_static("api-version"),
11154 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
11155 );
11156 #[allow(unused_mut)]
11157 let mut request = client
11158 .client
11159 .get(url)
11160 .header(
11161 ::reqwest::header::ACCEPT,
11162 ::reqwest::header::HeaderValue::from_static("application/json"),
11163 )
11164 .query(&progenitor_client::QueryParam::new("arriveBy", &arrive_by))
11165 .query(&progenitor_client::QueryParam::new(
11166 "elevationCosts",
11167 &elevation_costs,
11168 ))
11169 .query(&progenitor_client::QueryParam::new("many", &many))
11170 .query(&progenitor_client::QueryParam::new("max", &max))
11171 .query(&progenitor_client::QueryParam::new(
11172 "maxMatchingDistance",
11173 &max_matching_distance,
11174 ))
11175 .query(&progenitor_client::QueryParam::new("mode", &mode))
11176 .query(&progenitor_client::QueryParam::new("one", &one))
11177 .headers(header_map)
11178 .build()?;
11179 let info = OperationInfo {
11180 operation_id: "one_to_many",
11181 };
11182 client.pre(&mut request, &info).await?;
11183 let result = client.exec(request, &info).await;
11184 client.post(&result, &info).await?;
11185 let response = result?;
11186 match response.status().as_u16() {
11187 200u16 => ResponseValue::from_response(response).await,
11188 _ => Err(Error::UnexpectedResponse(response)),
11189 }
11190 }
11191 }
11192
11193 #[derive(Debug, Clone)]
11197 pub struct OneToAll<'a> {
11198 client: &'a super::Client,
11199 additional_transfer_time: Result<Option<i64>, String>,
11200 arrive_by: Result<Option<bool>, String>,
11201 elevation_costs: Result<Option<types::ElevationCosts>, String>,
11202 max_matching_distance: Result<Option<f64>, String>,
11203 max_post_transit_time: Result<Option<u64>, String>,
11204 max_pre_transit_time: Result<Option<u64>, String>,
11205 max_transfers: Result<Option<i64>, String>,
11206 max_travel_time: Result<i64, String>,
11207 min_transfer_time: Result<Option<i64>, String>,
11208 one: Result<::std::string::String, String>,
11209 pedestrian_profile: Result<Option<types::PedestrianProfile>, String>,
11210 post_transit_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
11211 pre_transit_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
11212 require_bike_transport: Result<Option<bool>, String>,
11213 require_car_transport: Result<Option<bool>, String>,
11214 time: Result<Option<::chrono::DateTime<::chrono::offset::Utc>>, String>,
11215 transfer_time_factor: Result<Option<f64>, String>,
11216 transit_modes: Result<Option<::std::vec::Vec<types::Mode>>, String>,
11217 use_routed_transfers: Result<Option<bool>, String>,
11218 }
11219
11220 impl<'a> OneToAll<'a> {
11221 pub fn new(client: &'a super::Client) -> Self {
11222 Self {
11223 client: client,
11224 additional_transfer_time: Ok(None),
11225 arrive_by: Ok(None),
11226 elevation_costs: Ok(None),
11227 max_matching_distance: Ok(None),
11228 max_post_transit_time: Ok(None),
11229 max_pre_transit_time: Ok(None),
11230 max_transfers: Ok(None),
11231 max_travel_time: Err("max_travel_time was not initialized".to_string()),
11232 min_transfer_time: Ok(None),
11233 one: Err("one was not initialized".to_string()),
11234 pedestrian_profile: Ok(None),
11235 post_transit_modes: Ok(None),
11236 pre_transit_modes: Ok(None),
11237 require_bike_transport: Ok(None),
11238 require_car_transport: Ok(None),
11239 time: Ok(None),
11240 transfer_time_factor: Ok(None),
11241 transit_modes: Ok(None),
11242 use_routed_transfers: Ok(None),
11243 }
11244 }
11245
11246 pub fn additional_transfer_time<V>(mut self, value: V) -> Self
11247 where
11248 V: std::convert::TryInto<i64>,
11249 {
11250 self.additional_transfer_time = value
11251 .try_into()
11252 .map(Some)
11253 .map_err(|_| "conversion to `i64` for additional_transfer_time failed".to_string());
11254 self
11255 }
11256
11257 pub fn arrive_by<V>(mut self, value: V) -> Self
11258 where
11259 V: std::convert::TryInto<bool>,
11260 {
11261 self.arrive_by = value
11262 .try_into()
11263 .map(Some)
11264 .map_err(|_| "conversion to `bool` for arrive_by failed".to_string());
11265 self
11266 }
11267
11268 pub fn elevation_costs<V>(mut self, value: V) -> Self
11269 where
11270 V: std::convert::TryInto<types::ElevationCosts>,
11271 {
11272 self.elevation_costs = value.try_into().map(Some).map_err(|_| {
11273 "conversion to `ElevationCosts` for elevation_costs failed".to_string()
11274 });
11275 self
11276 }
11277
11278 pub fn max_matching_distance<V>(mut self, value: V) -> Self
11279 where
11280 V: std::convert::TryInto<f64>,
11281 {
11282 self.max_matching_distance = value
11283 .try_into()
11284 .map(Some)
11285 .map_err(|_| "conversion to `f64` for max_matching_distance failed".to_string());
11286 self
11287 }
11288
11289 pub fn max_post_transit_time<V>(mut self, value: V) -> Self
11290 where
11291 V: std::convert::TryInto<u64>,
11292 {
11293 self.max_post_transit_time = value
11294 .try_into()
11295 .map(Some)
11296 .map_err(|_| "conversion to `u64` for max_post_transit_time failed".to_string());
11297 self
11298 }
11299
11300 pub fn max_pre_transit_time<V>(mut self, value: V) -> Self
11301 where
11302 V: std::convert::TryInto<u64>,
11303 {
11304 self.max_pre_transit_time = value
11305 .try_into()
11306 .map(Some)
11307 .map_err(|_| "conversion to `u64` for max_pre_transit_time failed".to_string());
11308 self
11309 }
11310
11311 pub fn max_transfers<V>(mut self, value: V) -> Self
11312 where
11313 V: std::convert::TryInto<i64>,
11314 {
11315 self.max_transfers = value
11316 .try_into()
11317 .map(Some)
11318 .map_err(|_| "conversion to `i64` for max_transfers failed".to_string());
11319 self
11320 }
11321
11322 pub fn max_travel_time<V>(mut self, value: V) -> Self
11323 where
11324 V: std::convert::TryInto<i64>,
11325 {
11326 self.max_travel_time = value
11327 .try_into()
11328 .map_err(|_| "conversion to `i64` for max_travel_time failed".to_string());
11329 self
11330 }
11331
11332 pub fn min_transfer_time<V>(mut self, value: V) -> Self
11333 where
11334 V: std::convert::TryInto<i64>,
11335 {
11336 self.min_transfer_time = value
11337 .try_into()
11338 .map(Some)
11339 .map_err(|_| "conversion to `i64` for min_transfer_time failed".to_string());
11340 self
11341 }
11342
11343 pub fn one<V>(mut self, value: V) -> Self
11344 where
11345 V: std::convert::TryInto<::std::string::String>,
11346 {
11347 self.one = value.try_into().map_err(|_| {
11348 "conversion to `:: std :: string :: String` for one failed".to_string()
11349 });
11350 self
11351 }
11352
11353 pub fn pedestrian_profile<V>(mut self, value: V) -> Self
11354 where
11355 V: std::convert::TryInto<types::PedestrianProfile>,
11356 {
11357 self.pedestrian_profile = value.try_into().map(Some).map_err(|_| {
11358 "conversion to `PedestrianProfile` for pedestrian_profile failed".to_string()
11359 });
11360 self
11361 }
11362
11363 pub fn post_transit_modes<V>(mut self, value: V) -> Self
11364 where
11365 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
11366 {
11367 self.post_transit_modes = value.try_into().map(Some).map_err(|_| {
11368 "conversion to `:: std :: vec :: Vec < Mode >` for post_transit_modes failed"
11369 .to_string()
11370 });
11371 self
11372 }
11373
11374 pub fn pre_transit_modes<V>(mut self, value: V) -> Self
11375 where
11376 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
11377 {
11378 self.pre_transit_modes = value.try_into().map(Some).map_err(|_| {
11379 "conversion to `:: std :: vec :: Vec < Mode >` for pre_transit_modes failed"
11380 .to_string()
11381 });
11382 self
11383 }
11384
11385 pub fn require_bike_transport<V>(mut self, value: V) -> Self
11386 where
11387 V: std::convert::TryInto<bool>,
11388 {
11389 self.require_bike_transport = value
11390 .try_into()
11391 .map(Some)
11392 .map_err(|_| "conversion to `bool` for require_bike_transport failed".to_string());
11393 self
11394 }
11395
11396 pub fn require_car_transport<V>(mut self, value: V) -> Self
11397 where
11398 V: std::convert::TryInto<bool>,
11399 {
11400 self.require_car_transport = value
11401 .try_into()
11402 .map(Some)
11403 .map_err(|_| "conversion to `bool` for require_car_transport failed".to_string());
11404 self
11405 }
11406
11407 pub fn time<V>(mut self, value: V) -> Self
11408 where
11409 V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
11410 {
11411 self . time = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for time failed" . to_string ()) ;
11412 self
11413 }
11414
11415 pub fn transfer_time_factor<V>(mut self, value: V) -> Self
11416 where
11417 V: std::convert::TryInto<f64>,
11418 {
11419 self.transfer_time_factor = value
11420 .try_into()
11421 .map(Some)
11422 .map_err(|_| "conversion to `f64` for transfer_time_factor failed".to_string());
11423 self
11424 }
11425
11426 pub fn transit_modes<V>(mut self, value: V) -> Self
11427 where
11428 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
11429 {
11430 self.transit_modes = value.try_into().map(Some).map_err(|_| {
11431 "conversion to `:: std :: vec :: Vec < Mode >` for transit_modes failed".to_string()
11432 });
11433 self
11434 }
11435
11436 pub fn use_routed_transfers<V>(mut self, value: V) -> Self
11437 where
11438 V: std::convert::TryInto<bool>,
11439 {
11440 self.use_routed_transfers = value
11441 .try_into()
11442 .map(Some)
11443 .map_err(|_| "conversion to `bool` for use_routed_transfers failed".to_string());
11444 self
11445 }
11446
11447 pub async fn send(self) -> Result<ResponseValue<types::Reachable>, Error<()>> {
11449 let Self {
11450 client,
11451 additional_transfer_time,
11452 arrive_by,
11453 elevation_costs,
11454 max_matching_distance,
11455 max_post_transit_time,
11456 max_pre_transit_time,
11457 max_transfers,
11458 max_travel_time,
11459 min_transfer_time,
11460 one,
11461 pedestrian_profile,
11462 post_transit_modes,
11463 pre_transit_modes,
11464 require_bike_transport,
11465 require_car_transport,
11466 time,
11467 transfer_time_factor,
11468 transit_modes,
11469 use_routed_transfers,
11470 } = self;
11471 let additional_transfer_time =
11472 additional_transfer_time.map_err(Error::InvalidRequest)?;
11473 let arrive_by = arrive_by.map_err(Error::InvalidRequest)?;
11474 let elevation_costs = elevation_costs.map_err(Error::InvalidRequest)?;
11475 let max_matching_distance = max_matching_distance.map_err(Error::InvalidRequest)?;
11476 let max_post_transit_time = max_post_transit_time.map_err(Error::InvalidRequest)?;
11477 let max_pre_transit_time = max_pre_transit_time.map_err(Error::InvalidRequest)?;
11478 let max_transfers = max_transfers.map_err(Error::InvalidRequest)?;
11479 let max_travel_time = max_travel_time.map_err(Error::InvalidRequest)?;
11480 let min_transfer_time = min_transfer_time.map_err(Error::InvalidRequest)?;
11481 let one = one.map_err(Error::InvalidRequest)?;
11482 let pedestrian_profile = pedestrian_profile.map_err(Error::InvalidRequest)?;
11483 let post_transit_modes = post_transit_modes.map_err(Error::InvalidRequest)?;
11484 let pre_transit_modes = pre_transit_modes.map_err(Error::InvalidRequest)?;
11485 let require_bike_transport = require_bike_transport.map_err(Error::InvalidRequest)?;
11486 let require_car_transport = require_car_transport.map_err(Error::InvalidRequest)?;
11487 let time = time.map_err(Error::InvalidRequest)?;
11488 let transfer_time_factor = transfer_time_factor.map_err(Error::InvalidRequest)?;
11489 let transit_modes = transit_modes.map_err(Error::InvalidRequest)?;
11490 let use_routed_transfers = use_routed_transfers.map_err(Error::InvalidRequest)?;
11491 let url = format!("{}/api/v1/one-to-all", client.baseurl,);
11492 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
11493 header_map.append(
11494 ::reqwest::header::HeaderName::from_static("api-version"),
11495 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
11496 );
11497 #[allow(unused_mut)]
11498 let mut request = client
11499 .client
11500 .get(url)
11501 .header(
11502 ::reqwest::header::ACCEPT,
11503 ::reqwest::header::HeaderValue::from_static("application/json"),
11504 )
11505 .query(&progenitor_client::QueryParam::new(
11506 "additionalTransferTime",
11507 &additional_transfer_time,
11508 ))
11509 .query(&progenitor_client::QueryParam::new("arriveBy", &arrive_by))
11510 .query(&progenitor_client::QueryParam::new(
11511 "elevationCosts",
11512 &elevation_costs,
11513 ))
11514 .query(&progenitor_client::QueryParam::new(
11515 "maxMatchingDistance",
11516 &max_matching_distance,
11517 ))
11518 .query(&progenitor_client::QueryParam::new(
11519 "maxPostTransitTime",
11520 &max_post_transit_time,
11521 ))
11522 .query(&progenitor_client::QueryParam::new(
11523 "maxPreTransitTime",
11524 &max_pre_transit_time,
11525 ))
11526 .query(&progenitor_client::QueryParam::new(
11527 "maxTransfers",
11528 &max_transfers,
11529 ))
11530 .query(&progenitor_client::QueryParam::new(
11531 "maxTravelTime",
11532 &max_travel_time,
11533 ))
11534 .query(&progenitor_client::QueryParam::new(
11535 "minTransferTime",
11536 &min_transfer_time,
11537 ))
11538 .query(&progenitor_client::QueryParam::new("one", &one))
11539 .query(&progenitor_client::QueryParam::new(
11540 "pedestrianProfile",
11541 &pedestrian_profile,
11542 ))
11543 .query(&progenitor_client::QueryParam::new(
11544 "postTransitModes",
11545 &post_transit_modes,
11546 ))
11547 .query(&progenitor_client::QueryParam::new(
11548 "preTransitModes",
11549 &pre_transit_modes,
11550 ))
11551 .query(&progenitor_client::QueryParam::new(
11552 "requireBikeTransport",
11553 &require_bike_transport,
11554 ))
11555 .query(&progenitor_client::QueryParam::new(
11556 "requireCarTransport",
11557 &require_car_transport,
11558 ))
11559 .query(&progenitor_client::QueryParam::new("time", &time))
11560 .query(&progenitor_client::QueryParam::new(
11561 "transferTimeFactor",
11562 &transfer_time_factor,
11563 ))
11564 .query(&progenitor_client::QueryParam::new(
11565 "transitModes",
11566 &transit_modes,
11567 ))
11568 .query(&progenitor_client::QueryParam::new(
11569 "useRoutedTransfers",
11570 &use_routed_transfers,
11571 ))
11572 .headers(header_map)
11573 .build()?;
11574 let info = OperationInfo {
11575 operation_id: "one_to_all",
11576 };
11577 client.pre(&mut request, &info).await?;
11578 let result = client.exec(request, &info).await;
11579 client.post(&result, &info).await?;
11580 let response = result?;
11581 match response.status().as_u16() {
11582 200u16 => ResponseValue::from_response(response).await,
11583 _ => Err(Error::UnexpectedResponse(response)),
11584 }
11585 }
11586 }
11587
11588 #[derive(Debug, Clone)]
11592 pub struct ReverseGeocode<'a> {
11593 client: &'a super::Client,
11594 place: Result<::std::string::String, String>,
11595 type_: Result<Option<types::LocationType>, String>,
11596 }
11597
11598 impl<'a> ReverseGeocode<'a> {
11599 pub fn new(client: &'a super::Client) -> Self {
11600 Self {
11601 client: client,
11602 place: Err("place was not initialized".to_string()),
11603 type_: Ok(None),
11604 }
11605 }
11606
11607 pub fn place<V>(mut self, value: V) -> Self
11608 where
11609 V: std::convert::TryInto<::std::string::String>,
11610 {
11611 self.place = value.try_into().map_err(|_| {
11612 "conversion to `:: std :: string :: String` for place failed".to_string()
11613 });
11614 self
11615 }
11616
11617 pub fn type_<V>(mut self, value: V) -> Self
11618 where
11619 V: std::convert::TryInto<types::LocationType>,
11620 {
11621 self.type_ = value
11622 .try_into()
11623 .map(Some)
11624 .map_err(|_| "conversion to `LocationType` for type_ failed".to_string());
11625 self
11626 }
11627
11628 pub async fn send(self) -> Result<ResponseValue<::std::vec::Vec<types::Match>>, Error<()>> {
11630 let Self {
11631 client,
11632 place,
11633 type_,
11634 } = self;
11635 let place = place.map_err(Error::InvalidRequest)?;
11636 let type_ = type_.map_err(Error::InvalidRequest)?;
11637 let url = format!("{}/api/v1/reverse-geocode", client.baseurl,);
11638 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
11639 header_map.append(
11640 ::reqwest::header::HeaderName::from_static("api-version"),
11641 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
11642 );
11643 #[allow(unused_mut)]
11644 let mut request = client
11645 .client
11646 .get(url)
11647 .header(
11648 ::reqwest::header::ACCEPT,
11649 ::reqwest::header::HeaderValue::from_static("application/json"),
11650 )
11651 .query(&progenitor_client::QueryParam::new("place", &place))
11652 .query(&progenitor_client::QueryParam::new("type", &type_))
11653 .headers(header_map)
11654 .build()?;
11655 let info = OperationInfo {
11656 operation_id: "reverse_geocode",
11657 };
11658 client.pre(&mut request, &info).await?;
11659 let result = client.exec(request, &info).await;
11660 client.post(&result, &info).await?;
11661 let response = result?;
11662 match response.status().as_u16() {
11663 200u16 => ResponseValue::from_response(response).await,
11664 _ => Err(Error::UnexpectedResponse(response)),
11665 }
11666 }
11667 }
11668
11669 #[derive(Debug, Clone)]
11673 pub struct Geocode<'a> {
11674 client: &'a super::Client,
11675 language: Result<Option<::std::string::String>, String>,
11676 place: Result<Option<::std::string::String>, String>,
11677 place_bias: Result<Option<f64>, String>,
11678 text: Result<::std::string::String, String>,
11679 type_: Result<Option<types::LocationType>, String>,
11680 }
11681
11682 impl<'a> Geocode<'a> {
11683 pub fn new(client: &'a super::Client) -> Self {
11684 Self {
11685 client: client,
11686 language: Ok(None),
11687 place: Ok(None),
11688 place_bias: Ok(None),
11689 text: Err("text was not initialized".to_string()),
11690 type_: Ok(None),
11691 }
11692 }
11693
11694 pub fn language<V>(mut self, value: V) -> Self
11695 where
11696 V: std::convert::TryInto<::std::string::String>,
11697 {
11698 self.language = value.try_into().map(Some).map_err(|_| {
11699 "conversion to `:: std :: string :: String` for language failed".to_string()
11700 });
11701 self
11702 }
11703
11704 pub fn place<V>(mut self, value: V) -> Self
11705 where
11706 V: std::convert::TryInto<::std::string::String>,
11707 {
11708 self.place = value.try_into().map(Some).map_err(|_| {
11709 "conversion to `:: std :: string :: String` for place failed".to_string()
11710 });
11711 self
11712 }
11713
11714 pub fn place_bias<V>(mut self, value: V) -> Self
11715 where
11716 V: std::convert::TryInto<f64>,
11717 {
11718 self.place_bias = value
11719 .try_into()
11720 .map(Some)
11721 .map_err(|_| "conversion to `f64` for place_bias failed".to_string());
11722 self
11723 }
11724
11725 pub fn text<V>(mut self, value: V) -> Self
11726 where
11727 V: std::convert::TryInto<::std::string::String>,
11728 {
11729 self.text = value.try_into().map_err(|_| {
11730 "conversion to `:: std :: string :: String` for text failed".to_string()
11731 });
11732 self
11733 }
11734
11735 pub fn type_<V>(mut self, value: V) -> Self
11736 where
11737 V: std::convert::TryInto<types::LocationType>,
11738 {
11739 self.type_ = value
11740 .try_into()
11741 .map(Some)
11742 .map_err(|_| "conversion to `LocationType` for type_ failed".to_string());
11743 self
11744 }
11745
11746 pub async fn send(self) -> Result<ResponseValue<::std::vec::Vec<types::Match>>, Error<()>> {
11748 let Self {
11749 client,
11750 language,
11751 place,
11752 place_bias,
11753 text,
11754 type_,
11755 } = self;
11756 let language = language.map_err(Error::InvalidRequest)?;
11757 let place = place.map_err(Error::InvalidRequest)?;
11758 let place_bias = place_bias.map_err(Error::InvalidRequest)?;
11759 let text = text.map_err(Error::InvalidRequest)?;
11760 let type_ = type_.map_err(Error::InvalidRequest)?;
11761 let url = format!("{}/api/v1/geocode", client.baseurl,);
11762 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
11763 header_map.append(
11764 ::reqwest::header::HeaderName::from_static("api-version"),
11765 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
11766 );
11767 #[allow(unused_mut)]
11768 let mut request = client
11769 .client
11770 .get(url)
11771 .header(
11772 ::reqwest::header::ACCEPT,
11773 ::reqwest::header::HeaderValue::from_static("application/json"),
11774 )
11775 .query(&progenitor_client::QueryParam::new("language", &language))
11776 .query(&progenitor_client::QueryParam::new("place", &place))
11777 .query(&progenitor_client::QueryParam::new(
11778 "placeBias",
11779 &place_bias,
11780 ))
11781 .query(&progenitor_client::QueryParam::new("text", &text))
11782 .query(&progenitor_client::QueryParam::new("type", &type_))
11783 .headers(header_map)
11784 .build()?;
11785 let info = OperationInfo {
11786 operation_id: "geocode",
11787 };
11788 client.pre(&mut request, &info).await?;
11789 let result = client.exec(request, &info).await;
11790 client.post(&result, &info).await?;
11791 let response = result?;
11792 match response.status().as_u16() {
11793 200u16 => ResponseValue::from_response(response).await,
11794 _ => Err(Error::UnexpectedResponse(response)),
11795 }
11796 }
11797 }
11798
11799 #[derive(Debug, Clone)]
11803 pub struct Trip<'a> {
11804 client: &'a super::Client,
11805 join_interlined_legs: Result<Option<bool>, String>,
11806 language: Result<Option<::std::string::String>, String>,
11807 trip_id: Result<::std::string::String, String>,
11808 with_scheduled_skipped_stops: Result<Option<bool>, String>,
11809 }
11810
11811 impl<'a> Trip<'a> {
11812 pub fn new(client: &'a super::Client) -> Self {
11813 Self {
11814 client: client,
11815 join_interlined_legs: Ok(None),
11816 language: Ok(None),
11817 trip_id: Err("trip_id was not initialized".to_string()),
11818 with_scheduled_skipped_stops: Ok(None),
11819 }
11820 }
11821
11822 pub fn join_interlined_legs<V>(mut self, value: V) -> Self
11823 where
11824 V: std::convert::TryInto<bool>,
11825 {
11826 self.join_interlined_legs = value
11827 .try_into()
11828 .map(Some)
11829 .map_err(|_| "conversion to `bool` for join_interlined_legs failed".to_string());
11830 self
11831 }
11832
11833 pub fn language<V>(mut self, value: V) -> Self
11834 where
11835 V: std::convert::TryInto<::std::string::String>,
11836 {
11837 self.language = value.try_into().map(Some).map_err(|_| {
11838 "conversion to `:: std :: string :: String` for language failed".to_string()
11839 });
11840 self
11841 }
11842
11843 pub fn trip_id<V>(mut self, value: V) -> Self
11844 where
11845 V: std::convert::TryInto<::std::string::String>,
11846 {
11847 self.trip_id = value.try_into().map_err(|_| {
11848 "conversion to `:: std :: string :: String` for trip_id failed".to_string()
11849 });
11850 self
11851 }
11852
11853 pub fn with_scheduled_skipped_stops<V>(mut self, value: V) -> Self
11854 where
11855 V: std::convert::TryInto<bool>,
11856 {
11857 self.with_scheduled_skipped_stops = value.try_into().map(Some).map_err(|_| {
11858 "conversion to `bool` for with_scheduled_skipped_stops failed".to_string()
11859 });
11860 self
11861 }
11862
11863 pub async fn send(self) -> Result<ResponseValue<types::Itinerary>, Error<()>> {
11865 let Self {
11866 client,
11867 join_interlined_legs,
11868 language,
11869 trip_id,
11870 with_scheduled_skipped_stops,
11871 } = self;
11872 let join_interlined_legs = join_interlined_legs.map_err(Error::InvalidRequest)?;
11873 let language = language.map_err(Error::InvalidRequest)?;
11874 let trip_id = trip_id.map_err(Error::InvalidRequest)?;
11875 let with_scheduled_skipped_stops =
11876 with_scheduled_skipped_stops.map_err(Error::InvalidRequest)?;
11877 let url = format!("{}/api/v4/trip", client.baseurl,);
11878 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
11879 header_map.append(
11880 ::reqwest::header::HeaderName::from_static("api-version"),
11881 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
11882 );
11883 #[allow(unused_mut)]
11884 let mut request = client
11885 .client
11886 .get(url)
11887 .header(
11888 ::reqwest::header::ACCEPT,
11889 ::reqwest::header::HeaderValue::from_static("application/json"),
11890 )
11891 .query(&progenitor_client::QueryParam::new(
11892 "joinInterlinedLegs",
11893 &join_interlined_legs,
11894 ))
11895 .query(&progenitor_client::QueryParam::new("language", &language))
11896 .query(&progenitor_client::QueryParam::new("tripId", &trip_id))
11897 .query(&progenitor_client::QueryParam::new(
11898 "withScheduledSkippedStops",
11899 &with_scheduled_skipped_stops,
11900 ))
11901 .headers(header_map)
11902 .build()?;
11903 let info = OperationInfo {
11904 operation_id: "trip",
11905 };
11906 client.pre(&mut request, &info).await?;
11907 let result = client.exec(request, &info).await;
11908 client.post(&result, &info).await?;
11909 let response = result?;
11910 match response.status().as_u16() {
11911 200u16 => ResponseValue::from_response(response).await,
11912 _ => Err(Error::UnexpectedResponse(response)),
11913 }
11914 }
11915 }
11916
11917 #[derive(Debug, Clone)]
11921 pub struct Stoptimes<'a> {
11922 client: &'a super::Client,
11923 arrive_by: Result<Option<bool>, String>,
11924 direction: Result<Option<types::StoptimesDirection>, String>,
11925 exact_radius: Result<Option<bool>, String>,
11926 fetch_stops: Result<Option<bool>, String>,
11927 language: Result<Option<::std::string::String>, String>,
11928 mode: Result<Option<::std::vec::Vec<types::Mode>>, String>,
11929 n: Result<i64, String>,
11930 page_cursor: Result<Option<::std::string::String>, String>,
11931 radius: Result<Option<i64>, String>,
11932 stop_id: Result<::std::string::String, String>,
11933 time: Result<Option<::chrono::DateTime<::chrono::offset::Utc>>, String>,
11934 with_scheduled_skipped_stops: Result<Option<bool>, String>,
11935 }
11936
11937 impl<'a> Stoptimes<'a> {
11938 pub fn new(client: &'a super::Client) -> Self {
11939 Self {
11940 client: client,
11941 arrive_by: Ok(None),
11942 direction: Ok(None),
11943 exact_radius: Ok(None),
11944 fetch_stops: Ok(None),
11945 language: Ok(None),
11946 mode: Ok(None),
11947 n: Err("n was not initialized".to_string()),
11948 page_cursor: Ok(None),
11949 radius: Ok(None),
11950 stop_id: Err("stop_id was not initialized".to_string()),
11951 time: Ok(None),
11952 with_scheduled_skipped_stops: Ok(None),
11953 }
11954 }
11955
11956 pub fn arrive_by<V>(mut self, value: V) -> Self
11957 where
11958 V: std::convert::TryInto<bool>,
11959 {
11960 self.arrive_by = value
11961 .try_into()
11962 .map(Some)
11963 .map_err(|_| "conversion to `bool` for arrive_by failed".to_string());
11964 self
11965 }
11966
11967 pub fn direction<V>(mut self, value: V) -> Self
11968 where
11969 V: std::convert::TryInto<types::StoptimesDirection>,
11970 {
11971 self.direction = value
11972 .try_into()
11973 .map(Some)
11974 .map_err(|_| "conversion to `StoptimesDirection` for direction failed".to_string());
11975 self
11976 }
11977
11978 pub fn exact_radius<V>(mut self, value: V) -> Self
11979 where
11980 V: std::convert::TryInto<bool>,
11981 {
11982 self.exact_radius = value
11983 .try_into()
11984 .map(Some)
11985 .map_err(|_| "conversion to `bool` for exact_radius failed".to_string());
11986 self
11987 }
11988
11989 pub fn fetch_stops<V>(mut self, value: V) -> Self
11990 where
11991 V: std::convert::TryInto<bool>,
11992 {
11993 self.fetch_stops = value
11994 .try_into()
11995 .map(Some)
11996 .map_err(|_| "conversion to `bool` for fetch_stops failed".to_string());
11997 self
11998 }
11999
12000 pub fn language<V>(mut self, value: V) -> Self
12001 where
12002 V: std::convert::TryInto<::std::string::String>,
12003 {
12004 self.language = value.try_into().map(Some).map_err(|_| {
12005 "conversion to `:: std :: string :: String` for language failed".to_string()
12006 });
12007 self
12008 }
12009
12010 pub fn mode<V>(mut self, value: V) -> Self
12011 where
12012 V: std::convert::TryInto<::std::vec::Vec<types::Mode>>,
12013 {
12014 self.mode = value.try_into().map(Some).map_err(|_| {
12015 "conversion to `:: std :: vec :: Vec < Mode >` for mode failed".to_string()
12016 });
12017 self
12018 }
12019
12020 pub fn n<V>(mut self, value: V) -> Self
12021 where
12022 V: std::convert::TryInto<i64>,
12023 {
12024 self.n = value
12025 .try_into()
12026 .map_err(|_| "conversion to `i64` for n failed".to_string());
12027 self
12028 }
12029
12030 pub fn page_cursor<V>(mut self, value: V) -> Self
12031 where
12032 V: std::convert::TryInto<::std::string::String>,
12033 {
12034 self.page_cursor = value.try_into().map(Some).map_err(|_| {
12035 "conversion to `:: std :: string :: String` for page_cursor failed".to_string()
12036 });
12037 self
12038 }
12039
12040 pub fn radius<V>(mut self, value: V) -> Self
12041 where
12042 V: std::convert::TryInto<i64>,
12043 {
12044 self.radius = value
12045 .try_into()
12046 .map(Some)
12047 .map_err(|_| "conversion to `i64` for radius failed".to_string());
12048 self
12049 }
12050
12051 pub fn stop_id<V>(mut self, value: V) -> Self
12052 where
12053 V: std::convert::TryInto<::std::string::String>,
12054 {
12055 self.stop_id = value.try_into().map_err(|_| {
12056 "conversion to `:: std :: string :: String` for stop_id failed".to_string()
12057 });
12058 self
12059 }
12060
12061 pub fn time<V>(mut self, value: V) -> Self
12062 where
12063 V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
12064 {
12065 self . time = value . try_into () . map (Some) . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for time failed" . to_string ()) ;
12066 self
12067 }
12068
12069 pub fn with_scheduled_skipped_stops<V>(mut self, value: V) -> Self
12070 where
12071 V: std::convert::TryInto<bool>,
12072 {
12073 self.with_scheduled_skipped_stops = value.try_into().map(Some).map_err(|_| {
12074 "conversion to `bool` for with_scheduled_skipped_stops failed".to_string()
12075 });
12076 self
12077 }
12078
12079 pub async fn send(self) -> Result<ResponseValue<types::StoptimesResponse>, Error<()>> {
12081 let Self {
12082 client,
12083 arrive_by,
12084 direction,
12085 exact_radius,
12086 fetch_stops,
12087 language,
12088 mode,
12089 n,
12090 page_cursor,
12091 radius,
12092 stop_id,
12093 time,
12094 with_scheduled_skipped_stops,
12095 } = self;
12096 let arrive_by = arrive_by.map_err(Error::InvalidRequest)?;
12097 let direction = direction.map_err(Error::InvalidRequest)?;
12098 let exact_radius = exact_radius.map_err(Error::InvalidRequest)?;
12099 let fetch_stops = fetch_stops.map_err(Error::InvalidRequest)?;
12100 let language = language.map_err(Error::InvalidRequest)?;
12101 let mode = mode.map_err(Error::InvalidRequest)?;
12102 let n = n.map_err(Error::InvalidRequest)?;
12103 let page_cursor = page_cursor.map_err(Error::InvalidRequest)?;
12104 let radius = radius.map_err(Error::InvalidRequest)?;
12105 let stop_id = stop_id.map_err(Error::InvalidRequest)?;
12106 let time = time.map_err(Error::InvalidRequest)?;
12107 let with_scheduled_skipped_stops =
12108 with_scheduled_skipped_stops.map_err(Error::InvalidRequest)?;
12109 let url = format!("{}/api/v4/stoptimes", client.baseurl,);
12110 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
12111 header_map.append(
12112 ::reqwest::header::HeaderName::from_static("api-version"),
12113 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
12114 );
12115 #[allow(unused_mut)]
12116 let mut request = client
12117 .client
12118 .get(url)
12119 .header(
12120 ::reqwest::header::ACCEPT,
12121 ::reqwest::header::HeaderValue::from_static("application/json"),
12122 )
12123 .query(&progenitor_client::QueryParam::new("arriveBy", &arrive_by))
12124 .query(&progenitor_client::QueryParam::new("direction", &direction))
12125 .query(&progenitor_client::QueryParam::new(
12126 "exactRadius",
12127 &exact_radius,
12128 ))
12129 .query(&progenitor_client::QueryParam::new(
12130 "fetchStops",
12131 &fetch_stops,
12132 ))
12133 .query(&progenitor_client::QueryParam::new("language", &language))
12134 .query(&progenitor_client::QueryParam::new("mode", &mode))
12135 .query(&progenitor_client::QueryParam::new("n", &n))
12136 .query(&progenitor_client::QueryParam::new(
12137 "pageCursor",
12138 &page_cursor,
12139 ))
12140 .query(&progenitor_client::QueryParam::new("radius", &radius))
12141 .query(&progenitor_client::QueryParam::new("stopId", &stop_id))
12142 .query(&progenitor_client::QueryParam::new("time", &time))
12143 .query(&progenitor_client::QueryParam::new(
12144 "withScheduledSkippedStops",
12145 &with_scheduled_skipped_stops,
12146 ))
12147 .headers(header_map)
12148 .build()?;
12149 let info = OperationInfo {
12150 operation_id: "stoptimes",
12151 };
12152 client.pre(&mut request, &info).await?;
12153 let result = client.exec(request, &info).await;
12154 client.post(&result, &info).await?;
12155 let response = result?;
12156 match response.status().as_u16() {
12157 200u16 => ResponseValue::from_response(response).await,
12158 _ => Err(Error::UnexpectedResponse(response)),
12159 }
12160 }
12161 }
12162
12163 #[derive(Debug, Clone)]
12167 pub struct Trips<'a> {
12168 client: &'a super::Client,
12169 end_time: Result<::chrono::DateTime<::chrono::offset::Utc>, String>,
12170 max: Result<::std::string::String, String>,
12171 min: Result<::std::string::String, String>,
12172 start_time: Result<::chrono::DateTime<::chrono::offset::Utc>, String>,
12173 zoom: Result<f64, String>,
12174 }
12175
12176 impl<'a> Trips<'a> {
12177 pub fn new(client: &'a super::Client) -> Self {
12178 Self {
12179 client: client,
12180 end_time: Err("end_time was not initialized".to_string()),
12181 max: Err("max was not initialized".to_string()),
12182 min: Err("min was not initialized".to_string()),
12183 start_time: Err("start_time was not initialized".to_string()),
12184 zoom: Err("zoom was not initialized".to_string()),
12185 }
12186 }
12187
12188 pub fn end_time<V>(mut self, value: V) -> Self
12189 where
12190 V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
12191 {
12192 self . end_time = value . try_into () . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for end_time failed" . to_string ()) ;
12193 self
12194 }
12195
12196 pub fn max<V>(mut self, value: V) -> Self
12197 where
12198 V: std::convert::TryInto<::std::string::String>,
12199 {
12200 self.max = value.try_into().map_err(|_| {
12201 "conversion to `:: std :: string :: String` for max failed".to_string()
12202 });
12203 self
12204 }
12205
12206 pub fn min<V>(mut self, value: V) -> Self
12207 where
12208 V: std::convert::TryInto<::std::string::String>,
12209 {
12210 self.min = value.try_into().map_err(|_| {
12211 "conversion to `:: std :: string :: String` for min failed".to_string()
12212 });
12213 self
12214 }
12215
12216 pub fn start_time<V>(mut self, value: V) -> Self
12217 where
12218 V: std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
12219 {
12220 self . start_time = value . try_into () . map_err (| _ | "conversion to `:: chrono :: DateTime < :: chrono :: offset :: Utc >` for start_time failed" . to_string ()) ;
12221 self
12222 }
12223
12224 pub fn zoom<V>(mut self, value: V) -> Self
12225 where
12226 V: std::convert::TryInto<f64>,
12227 {
12228 self.zoom = value
12229 .try_into()
12230 .map_err(|_| "conversion to `f64` for zoom failed".to_string());
12231 self
12232 }
12233
12234 pub async fn send(
12236 self,
12237 ) -> Result<ResponseValue<::std::vec::Vec<types::TripSegment>>, Error<()>> {
12238 let Self {
12239 client,
12240 end_time,
12241 max,
12242 min,
12243 start_time,
12244 zoom,
12245 } = self;
12246 let end_time = end_time.map_err(Error::InvalidRequest)?;
12247 let max = max.map_err(Error::InvalidRequest)?;
12248 let min = min.map_err(Error::InvalidRequest)?;
12249 let start_time = start_time.map_err(Error::InvalidRequest)?;
12250 let zoom = zoom.map_err(Error::InvalidRequest)?;
12251 let url = format!("{}/api/v4/map/trips", client.baseurl,);
12252 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
12253 header_map.append(
12254 ::reqwest::header::HeaderName::from_static("api-version"),
12255 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
12256 );
12257 #[allow(unused_mut)]
12258 let mut request = client
12259 .client
12260 .get(url)
12261 .header(
12262 ::reqwest::header::ACCEPT,
12263 ::reqwest::header::HeaderValue::from_static("application/json"),
12264 )
12265 .query(&progenitor_client::QueryParam::new("endTime", &end_time))
12266 .query(&progenitor_client::QueryParam::new("max", &max))
12267 .query(&progenitor_client::QueryParam::new("min", &min))
12268 .query(&progenitor_client::QueryParam::new(
12269 "startTime",
12270 &start_time,
12271 ))
12272 .query(&progenitor_client::QueryParam::new("zoom", &zoom))
12273 .headers(header_map)
12274 .build()?;
12275 let info = OperationInfo {
12276 operation_id: "trips",
12277 };
12278 client.pre(&mut request, &info).await?;
12279 let result = client.exec(request, &info).await;
12280 client.post(&result, &info).await?;
12281 let response = result?;
12282 match response.status().as_u16() {
12283 200u16 => ResponseValue::from_response(response).await,
12284 _ => Err(Error::UnexpectedResponse(response)),
12285 }
12286 }
12287 }
12288
12289 #[derive(Debug, Clone)]
12293 pub struct Initial<'a> {
12294 client: &'a super::Client,
12295 }
12296
12297 impl<'a> Initial<'a> {
12298 pub fn new(client: &'a super::Client) -> Self {
12299 Self { client: client }
12300 }
12301
12302 pub async fn send(self) -> Result<ResponseValue<types::InitialResponse>, Error<()>> {
12304 let Self { client } = self;
12305 let url = format!("{}/api/v1/map/initial", client.baseurl,);
12306 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
12307 header_map.append(
12308 ::reqwest::header::HeaderName::from_static("api-version"),
12309 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
12310 );
12311 #[allow(unused_mut)]
12312 let mut request = client
12313 .client
12314 .get(url)
12315 .header(
12316 ::reqwest::header::ACCEPT,
12317 ::reqwest::header::HeaderValue::from_static("application/json"),
12318 )
12319 .headers(header_map)
12320 .build()?;
12321 let info = OperationInfo {
12322 operation_id: "initial",
12323 };
12324 client.pre(&mut request, &info).await?;
12325 let result = client.exec(request, &info).await;
12326 client.post(&result, &info).await?;
12327 let response = result?;
12328 match response.status().as_u16() {
12329 200u16 => ResponseValue::from_response(response).await,
12330 _ => Err(Error::UnexpectedResponse(response)),
12331 }
12332 }
12333 }
12334
12335 #[derive(Debug, Clone)]
12339 pub struct Stops<'a> {
12340 client: &'a super::Client,
12341 max: Result<::std::string::String, String>,
12342 min: Result<::std::string::String, String>,
12343 }
12344
12345 impl<'a> Stops<'a> {
12346 pub fn new(client: &'a super::Client) -> Self {
12347 Self {
12348 client: client,
12349 max: Err("max was not initialized".to_string()),
12350 min: Err("min was not initialized".to_string()),
12351 }
12352 }
12353
12354 pub fn max<V>(mut self, value: V) -> Self
12355 where
12356 V: std::convert::TryInto<::std::string::String>,
12357 {
12358 self.max = value.try_into().map_err(|_| {
12359 "conversion to `:: std :: string :: String` for max failed".to_string()
12360 });
12361 self
12362 }
12363
12364 pub fn min<V>(mut self, value: V) -> Self
12365 where
12366 V: std::convert::TryInto<::std::string::String>,
12367 {
12368 self.min = value.try_into().map_err(|_| {
12369 "conversion to `:: std :: string :: String` for min failed".to_string()
12370 });
12371 self
12372 }
12373
12374 pub async fn send(self) -> Result<ResponseValue<::std::vec::Vec<types::Place>>, Error<()>> {
12376 let Self { client, max, min } = self;
12377 let max = max.map_err(Error::InvalidRequest)?;
12378 let min = min.map_err(Error::InvalidRequest)?;
12379 let url = format!("{}/api/v1/map/stops", client.baseurl,);
12380 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
12381 header_map.append(
12382 ::reqwest::header::HeaderName::from_static("api-version"),
12383 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
12384 );
12385 #[allow(unused_mut)]
12386 let mut request = client
12387 .client
12388 .get(url)
12389 .header(
12390 ::reqwest::header::ACCEPT,
12391 ::reqwest::header::HeaderValue::from_static("application/json"),
12392 )
12393 .query(&progenitor_client::QueryParam::new("max", &max))
12394 .query(&progenitor_client::QueryParam::new("min", &min))
12395 .headers(header_map)
12396 .build()?;
12397 let info = OperationInfo {
12398 operation_id: "stops",
12399 };
12400 client.pre(&mut request, &info).await?;
12401 let result = client.exec(request, &info).await;
12402 client.post(&result, &info).await?;
12403 let response = result?;
12404 match response.status().as_u16() {
12405 200u16 => ResponseValue::from_response(response).await,
12406 _ => Err(Error::UnexpectedResponse(response)),
12407 }
12408 }
12409 }
12410
12411 #[derive(Debug, Clone)]
12415 pub struct Levels<'a> {
12416 client: &'a super::Client,
12417 max: Result<::std::string::String, String>,
12418 min: Result<::std::string::String, String>,
12419 }
12420
12421 impl<'a> Levels<'a> {
12422 pub fn new(client: &'a super::Client) -> Self {
12423 Self {
12424 client: client,
12425 max: Err("max was not initialized".to_string()),
12426 min: Err("min was not initialized".to_string()),
12427 }
12428 }
12429
12430 pub fn max<V>(mut self, value: V) -> Self
12431 where
12432 V: std::convert::TryInto<::std::string::String>,
12433 {
12434 self.max = value.try_into().map_err(|_| {
12435 "conversion to `:: std :: string :: String` for max failed".to_string()
12436 });
12437 self
12438 }
12439
12440 pub fn min<V>(mut self, value: V) -> Self
12441 where
12442 V: std::convert::TryInto<::std::string::String>,
12443 {
12444 self.min = value.try_into().map_err(|_| {
12445 "conversion to `:: std :: string :: String` for min failed".to_string()
12446 });
12447 self
12448 }
12449
12450 pub async fn send(self) -> Result<ResponseValue<::std::vec::Vec<f64>>, Error<()>> {
12452 let Self { client, max, min } = self;
12453 let max = max.map_err(Error::InvalidRequest)?;
12454 let min = min.map_err(Error::InvalidRequest)?;
12455 let url = format!("{}/api/v1/map/levels", client.baseurl,);
12456 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
12457 header_map.append(
12458 ::reqwest::header::HeaderName::from_static("api-version"),
12459 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
12460 );
12461 #[allow(unused_mut)]
12462 let mut request = client
12463 .client
12464 .get(url)
12465 .header(
12466 ::reqwest::header::ACCEPT,
12467 ::reqwest::header::HeaderValue::from_static("application/json"),
12468 )
12469 .query(&progenitor_client::QueryParam::new("max", &max))
12470 .query(&progenitor_client::QueryParam::new("min", &min))
12471 .headers(header_map)
12472 .build()?;
12473 let info = OperationInfo {
12474 operation_id: "levels",
12475 };
12476 client.pre(&mut request, &info).await?;
12477 let result = client.exec(request, &info).await;
12478 client.post(&result, &info).await?;
12479 let response = result?;
12480 match response.status().as_u16() {
12481 200u16 => ResponseValue::from_response(response).await,
12482 _ => Err(Error::UnexpectedResponse(response)),
12483 }
12484 }
12485 }
12486
12487 #[derive(Debug, Clone)]
12491 pub struct Transfers<'a> {
12492 client: &'a super::Client,
12493 id: Result<::std::string::String, String>,
12494 }
12495
12496 impl<'a> Transfers<'a> {
12497 pub fn new(client: &'a super::Client) -> Self {
12498 Self {
12499 client: client,
12500 id: Err("id was not initialized".to_string()),
12501 }
12502 }
12503
12504 pub fn id<V>(mut self, value: V) -> Self
12505 where
12506 V: std::convert::TryInto<::std::string::String>,
12507 {
12508 self.id = value.try_into().map_err(|_| {
12509 "conversion to `:: std :: string :: String` for id failed".to_string()
12510 });
12511 self
12512 }
12513
12514 pub async fn send(self) -> Result<ResponseValue<types::TransfersResponse>, Error<()>> {
12516 let Self { client, id } = self;
12517 let id = id.map_err(Error::InvalidRequest)?;
12518 let url = format!("{}/api/debug/transfers", client.baseurl,);
12519 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
12520 header_map.append(
12521 ::reqwest::header::HeaderName::from_static("api-version"),
12522 ::reqwest::header::HeaderValue::from_static(super::Client::api_version()),
12523 );
12524 #[allow(unused_mut)]
12525 let mut request = client
12526 .client
12527 .get(url)
12528 .header(
12529 ::reqwest::header::ACCEPT,
12530 ::reqwest::header::HeaderValue::from_static("application/json"),
12531 )
12532 .query(&progenitor_client::QueryParam::new("id", &id))
12533 .headers(header_map)
12534 .build()?;
12535 let info = OperationInfo {
12536 operation_id: "transfers",
12537 };
12538 client.pre(&mut request, &info).await?;
12539 let result = client.exec(request, &info).await;
12540 client.post(&result, &info).await?;
12541 let response = result?;
12542 match response.status().as_u16() {
12543 200u16 => ResponseValue::from_response(response).await,
12544 _ => Err(Error::UnexpectedResponse(response)),
12545 }
12546 }
12547 }
12548}
12549
12550pub mod prelude {
12552 pub use self::super::Client;
12553}