api: Add impl FromStr for MatrixVersion
Enables `str.parse::<MatrixVersion>()`.
This commit is contained in:
parent
ae4c9243cb
commit
1e94c3cd39
@ -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, Self::Err> {
|
||||
Self::try_from(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl MatrixVersion {
|
||||
/// Checks whether a version is compatible with another.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user