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