pub fn from_id(id: &str) -> Result<Self> {
        match id.strip_prefix("//") {
            Some(path) => {
                if path.matches(':').count() != 1 {
                    return Err(Error::EvalModule(anyhow!(
                        "module id '{}' should contain exactly one ':'",
                        id
                    )));
                }
                Self::new(Path::new("/").join(path.replace(':', "/")))
            }
            None => Err(Error::EvalModule(anyhow!(
                "module id '{}' not absolute",
                id
            ))),
        }
    }
/// Convert a canonical id string to a [ModuleId]. Fails if the id is not
/// canonical in any way.
Convert a canonical id string to a [ModuleId]. Fails if the id is not
canonical in any way.
Convert a canonical id string to a [ ModuleId ] . Fails if the id is not canonical in any way .
pub fn from_id(id: &str) -> Result<Self> {
        match id.strip_prefix("//") {
            Some(path) => {
                if path.matches(':').count() != 1 {
                    return Err(Error::EvalModule(anyhow!(
                        "module id '{}' should contain exactly one ':'",
                        id
                    )));
                }
                Self::new(Path::new("/").join(path.replace(':', "/")))
            }
            None => Err(Error::EvalModule(anyhow!(
                "module id '{}' not absolute",
                id
            ))),
        }
    }
pub fn from_id ( id : & str ) -> Result < Self > { match id . strip_prefix ( " " ) { Some ( path ) => { if path . matches ( ':' ) . count ( ) != 1 { return Err ( Error :: EvalModule ( anyhow ! ( " " id ) ) ) ; } Self :: new ( Path :: new ( " " ) . join ( path . replace ( ':' , " " ) ) ) } None => Err ( Error :: EvalModule ( anyhow ! ( " " id ) ) ) , } }
Convert a canonical id string to a [ModuleId].
Convert a canonical id string to a [ ModuleId ] .
id
&str
id
&str