1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
use HashMap;
use DeserializeOwned;
use Serialize;
use crate;
/// A typed application route.
///
/// Route values are owned by Rust, serialized across the bridge, and executed by a Flutter
/// navigation handler (Navigator 1.0 or GoRouter).
///
/// # Deep links
///
/// A route can optionally describe how to map itself to and from a URL:
///
/// - [`Route::path`] defines an addressable template (e.g. `"/player/:trackId"`).
/// - [`Route::params`] provides template parameter substitutions.
/// - [`Route::query`] provides query parameters.
///
/// Extras returned by [`Route::extras`] are not encoded into the URL and are only available
/// when navigation is initiated within the running app.
///
/// # Example
///
/// ```rust
/// use oxide_core::navigation::{NoExtra, NoReturn, Route};
/// use serde::{Deserialize, Serialize};
/// use std::collections::HashMap;
///
/// #[derive(Clone, Serialize, Deserialize)]
/// pub struct PlayerRoute {
/// pub track_id: String,
/// pub autoplay: bool,
/// }
///
/// impl Route for PlayerRoute {
/// fn path() -> Option<&'static str> {
/// Some("/player/:trackId")
/// }
///
/// fn params(&self) -> HashMap<&'static str, String> {
/// HashMap::from([("trackId", self.track_id.clone())])
/// }
///
/// fn query(&self) -> HashMap<&'static str, String> {
/// HashMap::from([("autoplay", self.autoplay.to_string())])
/// }
///
/// type Return = NoReturn;
/// type Extra = NoExtra;
/// }
/// ```