Make blueprint code slightly more resilient to changes.
Leverage traits instead of hard-coded type parameters.
This commit is contained in:
@@ -109,7 +109,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Blueprint<Schema> {
|
impl<T: serde::Serialize + Default> Display for Blueprint<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let s = serde_json::to_string_pretty(self).map_err(|_| fmt::Error)?;
|
let s = serde_json::to_string_pretty(self).map_err(|_| fmt::Error)?;
|
||||||
f.write_str(&s)
|
f.write_str(&s)
|
||||||
|
|||||||
@@ -334,9 +334,10 @@ impl Data {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Needed because of Blueprint's default, but actually never used.
|
||||||
impl Default for Schema {
|
impl Default for Schema {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Schema::Unit
|
Schema::Data(Data::Opaque)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user