diff options
Diffstat (limited to 'src/repo_ref.rs')
| -rw-r--r-- | src/repo_ref.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/repo_ref.rs b/src/repo_ref.rs index 3e1fd22..5d754f2 100644 --- a/src/repo_ref.rs +++ b/src/repo_ref.rs | |||
| @@ -191,6 +191,25 @@ impl RepoRef { | |||
| 191 | } | 191 | } |
| 192 | res | 192 | res |
| 193 | } | 193 | } |
| 194 | |||
| 195 | /// coordinates without relay hints | ||
| 196 | pub fn coordinate_with_hint(&self) -> Coordinate { | ||
| 197 | Coordinate { | ||
| 198 | kind: Kind::Custom(REPO_REF_KIND), | ||
| 199 | public_key: *self | ||
| 200 | .maintainers | ||
| 201 | .first() | ||
| 202 | .context("no maintainers in repo ref") | ||
| 203 | .unwrap(), | ||
| 204 | identifier: self.identifier.clone(), | ||
| 205 | relays: if let Some(relay) = self.relays.first() { | ||
| 206 | vec![relay.to_string()] | ||
| 207 | } else { | ||
| 208 | vec![] | ||
| 209 | }, | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 194 | /// coordinates without relay hints | 213 | /// coordinates without relay hints |
| 195 | pub fn coordinates_with_timestamps(&self) -> Vec<(Coordinate, Option<Timestamp>)> { | 214 | pub fn coordinates_with_timestamps(&self) -> Vec<(Coordinate, Option<Timestamp>)> { |
| 196 | self.coordinates() | 215 | self.coordinates() |