Make codec shape authority compile-time and fixed
This commit is contained in:
parent
bfe21dfb3f
commit
54cc167f81
1 changed files with 322 additions and 52 deletions
|
|
@ -863,13 +863,15 @@ fn ensure_absent(
|
|||
}
|
||||
}
|
||||
|
||||
fn encode<T: serde::Serialize>(value: &T) -> Result<Vec<u8>, CatalogError> {
|
||||
fn encode<T: lazaret_core::records::SchemaType + serde::Serialize>(
|
||||
value: &T,
|
||||
) -> Result<Vec<u8>, CatalogError> {
|
||||
codec::encode(value).map_err(CatalogError::Codec)
|
||||
}
|
||||
|
||||
fn decode_row<T>(encoded: &[u8]) -> Result<T, CatalogError>
|
||||
where
|
||||
T: serde::de::DeserializeOwned + serde::Serialize,
|
||||
T: lazaret_core::records::SchemaType + serde::de::DeserializeOwned + serde::Serialize,
|
||||
{
|
||||
codec::decode(encoded).map_err(CatalogError::Codec)
|
||||
}
|
||||
|
|
@ -889,7 +891,9 @@ fn lease_key(lease: &ArtifactLease) -> [u8; 40] {
|
|||
key
|
||||
}
|
||||
|
||||
trait CatalogRecord: Eq + serde::de::DeserializeOwned + serde::Serialize {
|
||||
trait CatalogRecord:
|
||||
Eq + lazaret_core::records::SchemaType + serde::de::DeserializeOwned + serde::Serialize
|
||||
{
|
||||
const ROW: CatalogRow;
|
||||
|
||||
fn catalog_key(&self) -> Vec<u8>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue