svg: Implement FromStr for Dom
@@ -9,6 +9,7 @@ use std::{
error::Error,
fmt,
io::{self, Read},
+ str::FromStr,
};
pub type Dom = RCHandle<sb::SkSVGDOM>;
@@ -119,6 +120,14 @@ impl fmt::Debug for Dom {
}
}
+impl FromStr for Dom {
+ type Err = LoadError;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ Self::from_bytes(s.as_bytes())
+ }
+}
+
impl Dom {
fn handle_load_base64(data: &str) -> Data {
let data: Vec<_> = data.split(',').collect();
