fix str to mxc conversion; add convenience OwnedMxcUri conversion

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-16 06:22:38 +00:00
parent 01e910dccf
commit 25fbd64b96

View File

@ -84,6 +84,16 @@ impl<'a> TryFrom<&'a str> for Mxc<'a> {
type Error = MxcUriError; type Error = MxcUriError;
fn try_from(s: &'a str) -> Result<Self, Self::Error> { fn try_from(s: &'a str) -> Result<Self, Self::Error> {
let s: &MxcUri = s.into();
s.try_into()
}
}
impl<'a> TryFrom<&'a OwnedMxcUri> for Mxc<'a> {
type Error = MxcUriError;
fn try_from(s: &'a OwnedMxcUri) -> Result<Self, Self::Error> {
let s: &MxcUri = s.as_ref();
s.try_into() s.try_into()
} }
} }