Radish alpha
r
rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt
Git libraries for Radicle
Radicle
Git
Merge remote-tracking branch 'origin/trailer-improvements'
Fintan Halpenny committed 3 years ago
commit e913628f0d78d44b8e18db7f491e32a7dd155691
parent ea0afc4
2 files changed +19 -3
modified git-trailers/Cargo.toml
@@ -1,9 +1,15 @@
[package]
name = "git-trailers"
version = "0.1.0"
-
authors = ["Nuno Alexandre <hi@nunoalexandre.com>", "Kim Altintop <kim@eagain.st>"]
+
authors = [
+
  "Nuno Alexandre <hi@nunoalexandre.com>",
+
  "Kim Altintop <kim@eagain.st>",
+
  "Fintan Halpenny <fintan.halpenny@gmail.com>",
+
]
edition = "2018"
license = "GPL-3.0-or-later"
+
description = "Library to support parsing and display git trailers <https://git-scm.com/docs/git-interpret-trailers>"
+
keywords = ["git"]

[lib]
doctest = false
modified git-trailers/src/lib.rs
@@ -45,11 +45,13 @@ pub struct Token<'a>(&'a str);

/// A version of the Trailer<'a> which owns it's token and values. Useful for
/// when you need to carry trailers around in a long lived data structure.
+
#[derive(Debug)]
pub struct OwnedTrailer {
-
    token: OwnedToken,
-
    values: Vec<String>,
+
    pub token: OwnedToken,
+
    pub values: Vec<String>,
}

+
#[derive(Debug)]
pub struct OwnedToken(String);

impl<'a> From<&Trailer<'a>> for OwnedTrailer {
@@ -76,6 +78,14 @@ impl<'a> From<&'a OwnedTrailer> for Trailer<'a> {
    }
}

+
impl Deref for OwnedToken {
+
    type Target = str;
+

+
    fn deref(&self) -> &Self::Target {
+
        &self.0
+
    }
+
}
+

#[derive(Debug, Error)]
#[non_exhaustive]
pub enum InvalidToken {