diff options
Diffstat (limited to 'src/github.rs')
-rw-r--r-- | src/github.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/github.rs b/src/github.rs index 0b20abd..b937f9b 100644 --- a/src/github.rs +++ b/src/github.rs @@ -31,6 +31,15 @@ pub struct Repo { pub updated_at: String, // TODO: Maybe parse to date? } +impl Repo { + /// Get the repository description or an empty string if `None`. + pub fn description(&self) -> &str { + self.description + .as_deref() + .unwrap_or("") + } +} + pub fn fetch_repos() -> Result<Vec<Repo>, Error> { let mut headers = reqwest::header::HeaderMap::new(); |