Closed shuimuliang closed 7 months ago
Result<_, Err> location: bp-std/derive/src/path.rs ln175
impl<I: FromStr> FromStr for DerivationPath<I>
where IndexParseError: From<<I as FromStr>::Err>
{
type Err = DerivationParseError;
fn from_str(mut s: &str) -> Result<Self, Self::Err> {
if s.starts_with('/') {
s = &s[1..];
}
let inner = s
.split('/')
.map(I::from_str)
.collect::<Result<Vec<_>, I::Err>>()
.map_err(|err| DerivationParseError::InvalidIndex(s.to_owned(), err.into()))?;
if inner.is_empty() {
return Err(DerivationParseError::InvalidFormat(s.to_owned()));
}
Ok(Self(inner))
}
}
Cargo.toml