Skip to content

Commit e2a1638

Browse files
authored
restore public impls for MapType introduced in v0.3.0 (#871)
1 parent 82270bf commit e2a1638

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

typify-impl/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,34 @@ impl std::fmt::Display for MapType {
263263
}
264264
}
265265

266+
impl<'de> serde::Deserialize<'de> for MapType {
267+
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
268+
where
269+
D: serde::Deserializer<'de>,
270+
{
271+
let s = <&str>::deserialize(deserializer)?;
272+
Ok(Self::new(s))
273+
}
274+
}
275+
276+
impl From<String> for MapType {
277+
fn from(s: String) -> Self {
278+
Self::new(&s)
279+
}
280+
}
281+
266282
impl From<&str> for MapType {
267283
fn from(s: &str) -> Self {
268284
Self::new(s)
269285
}
270286
}
271287

288+
impl From<syn::Type> for MapType {
289+
fn from(t: syn::Type) -> Self {
290+
Self(t)
291+
}
292+
}
293+
272294
/// Settings that alter type generation.
273295
#[derive(Default, Debug, Clone)]
274296
pub struct TypeSpaceSettings {

0 commit comments

Comments
 (0)