use crate::assets::storage::types::state::{StableEncodingChunkKey, StableKey};
use ic_stable_structures::storable::Bound;
use ic_stable_structures::Storable;
use junobuild_shared::memory::serializers::{
deserialize_from_bytes, serialize_into_bytes, serialize_to_bytes,
};
use std::borrow::Cow;
impl Storable for StableKey {
fn to_bytes(&self) -> Cow<'_, [u8]> {
serialize_to_bytes(self)
}
fn into_bytes(self) -> Vec<u8> {
serialize_into_bytes(&self)
}
fn from_bytes(bytes: Cow<[u8]>) -> Self {
deserialize_from_bytes(bytes)
}
const BOUND: Bound = Bound::Unbounded;
}
impl Storable for StableEncodingChunkKey {
fn to_bytes(&self) -> Cow<'_, [u8]> {
serialize_to_bytes(self)
}
fn into_bytes(self) -> Vec<u8> {
serialize_into_bytes(&self)
}
fn from_bytes(bytes: Cow<[u8]>) -> Self {
deserialize_from_bytes(bytes)
}
const BOUND: Bound = Bound::Unbounded;
}