Make codec shape authority compile-time and fixed

This commit is contained in:
ms2k 2026-07-19 04:33:43 +09:00
commit 54cc167f81

View file

@ -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>;