Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Exchange From for TryFrom for PathBuf and Home
Fintan Halpenny committed 3 years ago
commit ef0628c48e85d55feea03632831b3e418d67a9ec
parent b04451a1bd4f9fc3ef312d15a96f99d9b6a26c68
3 files changed +9 -5
modified radicle-cli/examples/rad-patch.md
@@ -56,7 +56,7 @@ $ rad patch
- YOU PROPOSED -

define power requirements d4ef85f57a8 R0 3e674d1 (flux-capacitor-power) ahead 1, behind 0
-
└─ * opened by z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [..]
+
└─ * opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [..]
└─ * patch id d4ef85f57a849bd845915d7a66a2192cd23811f6

- OTHERS PROPOSED -
modified radicle-httpd/src/api/test.rs
@@ -1,3 +1,4 @@
+
use std::convert::TryInto as _;
use std::path::Path;
use std::str::FromStr;
use std::sync::Arc;
@@ -81,7 +82,8 @@ pub fn seed(dir: &Path) -> Context {
    .unwrap();

    // eq. rad auth
-
    let profile = radicle::Profile::init(rad_home.into(), PASSWORD.to_owned()).unwrap();
+
    let profile =
+
        radicle::Profile::init(rad_home.try_into().unwrap(), PASSWORD.to_owned()).unwrap();

    // rad init
    rad_init::init(
modified radicle/src/profile.rs
@@ -163,9 +163,11 @@ pub struct Home {
    path: PathBuf,
}

-
impl From<PathBuf> for Home {
-
    fn from(path: PathBuf) -> Self {
-
        Self { path }
+
impl TryFrom<PathBuf> for Home {
+
    type Error = io::Error;
+

+
    fn try_from(home: PathBuf) -> Result<Self, Self::Error> {
+
        Self::new(home)
    }
}