Train reservation system in Rust as my practice
let time: &amp;[&amp;str] = &amp;["12:00", "14:00", "18:00", "19:00"];
let mut stations = HashMap::new();
stations.insert(
    reserve_request::Stations {
        start: "Tokyo",
        destination: "Kyoto",
    },
    time,
);


Ok, I assume you tried putting the value assigned to time directly in the expression, but were unable to resolve the resulting error message. The problem is that expression has the type [&amp;str; 4], an array. But you want a slice: &amp;[&amp;str] instead. There a few ways to resolve this:

Firstly, you can specify the type of the HashMap:

let mut stations: HashMap&lt;reserve_request::Stations, &amp;[&amp;str]&gt; = HashMap::new();
stations.insert(
    reserve_request::Stations {
        start: "Tokyo",
        destination: "Kyoto",
    },
    &amp;["12:00", "14:00", "18:00", "19:00"]
);


This way, Rust will infer what type you actually wanted at convert the reference to an array into a slice.

Alternatively, you can manually request a slice by called .as_ref() on the array:

let mut stations = HashMap::new();
stations.insert(
    reserve_request::Stations {
        start: "Tokyo",
        destination: "Kyoto",
    },
    ["12:00", "14:00", "18:00", "19:00"].as_ref()
);


However, a better approach would be to not use arrays at all. Rust arrays are really just not that useful, and you almost always should prefer to use a Vec. Furthermore, if you implement loading from JSON as your comment suggests, then you'll certainly get a Vec and not a slice. 

let mut stations = HashMap::new();
stations.insert(
    reserve_request::Stations {
        start: "Tokyo",
        destination: "Kyoto",
    },
    vec!["12:00", "14:00", "18:00", "19:00"]
);


Moving on the second part where you had an issue:

    let times = timetable.get(&amp;st);
    let default: &amp;[&amp;str] = &amp;[];


Firstly, we have the same problem as before with a (in this case empty) array. It can be solved in the same way as above.

    let result = match times {
        Some(r) =&gt; r,
        None =&gt; default,
    };


Option has a method, unwrap_or which does the same thing:

    let result = timetable.get(&amp;st).unwrap_or([].as_slice());


However, a better approach would be use an if let statement.

    if let Some(times) = timetable.get(&amp;st) {
        for t in times {
            if *t == self.time {
                return true;
            }
        }
    }


This way the loop over times only runs if it was present and you don't need to create and iterate over an empty slice.

However, if you use Vec instead of slices as I suggest, the inner loop can be written as a call to the contains function:

        if times.contains(&amp;self.time) {
            return true;
        }


Or you can replace the whole function with:

        timetable
            .get(&amp;Stations {
                start: self.start,
                destination: self.destination
            })
            .map_or(false, |times| times.contains(&amp;self.time))


map_or returns false if the time table was not found, otherwise it calls the closure which checks if times contains the appropriate time.