feat(linked chunk): add trait-based conversions between owned and borrowed linked chunk id

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
This commit is contained in:
Michael Goldenberg
2025-08-14 10:04:06 -04:00
committed by Ivan Enderlin
parent f180a14c88
commit 64698eaf1a

View File

@@ -134,6 +134,12 @@ impl LinkedChunkId<'_> {
}
}
impl<'a> From<&'a OwnedLinkedChunkId> for LinkedChunkId<'a> {
fn from(value: &'a OwnedLinkedChunkId) -> Self {
value.as_ref()
}
}
impl PartialEq<&OwnedLinkedChunkId> for LinkedChunkId<'_> {
fn eq(&self, other: &&OwnedLinkedChunkId) -> bool {
match (self, other) {
@@ -189,6 +195,12 @@ impl OwnedLinkedChunkId {
}
}
impl From<LinkedChunkId<'_>> for OwnedLinkedChunkId {
fn from(value: LinkedChunkId<'_>) -> Self {
value.to_owned()
}
}
/// Errors of [`LinkedChunk`].
#[derive(thiserror::Error, Debug)]
pub enum Error {