diff --git a/crates/ruma-api/src/metadata.rs b/crates/ruma-api/src/metadata.rs index 424a6929..459b5ddf 100644 --- a/crates/ruma-api/src/metadata.rs +++ b/crates/ruma-api/src/metadata.rs @@ -1,6 +1,7 @@ use std::{ convert::TryFrom, fmt::{self, Display}, + str::FromStr, }; use http::Method; @@ -111,6 +112,14 @@ impl TryFrom<&str> for MatrixVersion { } } +impl FromStr for MatrixVersion { + type Err = UnknownVersionError; + + fn from_str(s: &str) -> Result { + Self::try_from(s) + } +} + impl MatrixVersion { /// Checks whether a version is compatible with another. ///