Make blueprint code slightly more resilient to changes.
Leverage traits instead of hard-coded type parameters.
This commit is contained in:
parent
e44f18bae5
commit
3a7aac0a33
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue