Unified stack `GetValue` implementation
parent: tbd commit: 325f5af
1 | use ; |
2 | |
3 | use ; |
4 | use Error; |
5 | |
6 | |
7 | |
8 | |
9 | pub use *; |
10 | use Url; |
11 | pub use *; |
12 | |
13 | use crate GiteratedObject; |
14 | |
15 | |
16 | pub url: String, |
17 | pub public_key: String, |
18 | |
19 | |
20 | /// An instance, defined by the URL it can be reached at. |
21 | /// |
22 | /// # Textual Format |
23 | /// An instance's textual format is its URL. |
24 | /// |
25 | /// ## Examples |
26 | /// For the instance `giterated.dev`, the following [`Instance`] initialization |
27 | /// would be valid: |
28 | /// |
29 | /// ``` |
30 | /// let instance = Instance { |
31 | /// url: String::from("giterated.dev") |
32 | /// }; |
33 | /// |
34 | /// // This is correct |
35 | /// assert_eq!(Instance::from_str("giterated.dev").unwrap(), instance); |
36 | /// ``` |
37 | |
38 | ; |
39 | |
40 | |
41 | |
42 | "instance" |
43 | |
44 | |
45 | |
46 | Ok |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | f.write_str |
53 | |
54 | |
55 | |
56 | |
57 | type Err = InstanceParseError; |
58 | |
59 | |
60 | let with_protocol = format!; |
61 | |
62 | if parse .is_ok |
63 | Ok |
64 | else |
65 | Err |
66 | |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | InvalidFormat, |
74 | |
75 |