Make blueprint code slightly more resilient to changes.

Leverage traits instead of hard-coded type parameters.
This commit is contained in:
KtorZ 2023-03-10 09:15:42 +01:00 committed by Lucas
parent e44f18bae5
commit 3a7aac0a33
2 changed files with 3 additions and 2 deletions

View File

@ -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 {
let s = serde_json::to_string_pretty(self).map_err(|_| fmt::Error)?;
f.write_str(&s)

View File

@ -334,9 +334,10 @@ impl Data {
}
}
// Needed because of Blueprint's default, but actually never used.
impl Default for Schema {
fn default() -> Self {
Schema::Unit
Schema::Data(Data::Opaque)
}
}