Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
heartwood crates radicle-cob src test identity.rs
pub mod project;
pub use project::{Project, RemoteProject};

#[cfg(feature = "git2")]
pub mod person;
#[cfg(feature = "git2")]
pub use person::Person;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Urn {
    pub name: Name,
    pub remote: Option<Name>,
}

impl Urn {
    pub fn to_path(&self) -> String {
        match &self.remote {
            Some(remote) => format!("{}/{}", self.name.as_str(), remote.as_str()),
            None => self.name.0.to_string(),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Name(String);

impl Name {
    pub fn as_str(&self) -> &str {
        &self.0
    }
}