summaryrefslogtreecommitdiff
path: root/src/travelynx.rs
diff options
context:
space:
mode:
authorstuebinm2022-02-26 13:28:15 +0100
committerstuebinm2022-02-26 13:28:15 +0100
commit0de9008a3df42d171f01f0d431861c9d765b5234 (patch)
tree814b96ef03e7892ee81a2252cb266fc758201671 /src/travelynx.rs
parentcea0b70a51d73c9eda7b2cf83451ca328182f0a8 (diff)
from / to commands for travelynx
Diffstat (limited to 'src/travelynx.rs')
-rw-r--r--src/travelynx.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/travelynx.rs b/src/travelynx.rs
index c5351eb..c3318ab 100644
--- a/src/travelynx.rs
+++ b/src/travelynx.rs
@@ -2,7 +2,7 @@ use clap::Args;
use colored::*;
use serde::{Deserialize, Serialize};
-use crate::types::Status;
+use crate::types::{Status, Train};
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
@@ -56,6 +56,15 @@ impl std::fmt::Display for TrainRef {
}
}
+impl std::convert::From<Train> for TrainRef {
+ fn from(from: Train) -> Self {
+ TrainRef {
+ _type: from._type,
+ no: from.no
+ }
+ }
+}
+
#[derive(Deserialize, Debug)]
pub struct Response {
success: Option<bool>,