identifiers: Implement TryFrom<&str> for MatrixToUri

This commit is contained in:
Kévin Commaille 2022-02-19 11:42:58 +01:00
parent f6f3ce074b
commit e9be719a33
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C

View File

@ -226,6 +226,14 @@ impl fmt::Display for MatrixToUri {
} }
} }
impl TryFrom<&str> for MatrixToUri {
type Error = Error;
fn try_from(s: &str) -> Result<Self, Self::Error> {
Self::parse(s)
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use matches::assert_matches; use matches::assert_matches;