Radish alpha
r
Git libraries for Radicle
Radicle
Git (anonymous pull)
Log in to clone via SSH
git-ref-format: Component::from_refstr
Fintan Halpenny committed 3 years ago
commit d6c7bb29abc0f0050e2efe8de47397eaa4564f6f
parent 629191f55afe77c00808cfe3d6f35d4cff1f4f73
1 file changed +4 -3
modified git-ref-format/core/src/name/iter.rs
@@ -9,7 +9,7 @@ use std::{
    ops::Deref,
};

-
use super::{RefStr, RefString};
+
use super::RefStr;
use crate::lit;

pub type Iter<'a> = std::str::Split<'a, char>;
@@ -52,9 +52,10 @@ pub struct Component<'a>(Cow<'a, RefStr>);

impl<'a> Component<'a> {
    #[inline]
-
    pub fn from_refstring(r: RefString) -> Option<Self> {
+
    pub fn from_refstr(r: impl Into<Cow<'a, RefStr>>) -> Option<Self> {
+
        let r = r.into();
        if !r.contains('/') {
-
            Some(Self(Cow::Owned(r)))
+
            Some(Self(r))
        } else {
            None
        }