MCPcopy Index your code
hub / github.com/RetypeOS/parcode / ParcodeNative

Interface ParcodeNative

src/reader.rs:296–318  ·  view source on GitHub ↗

A trait for types that know how to reconstruct themselves from a [`ChunkNode`]. This trait enables the high-level API ([`Parcode::load`](crate::Parcode::load)) to automatically select the optimal reconstruction strategy based on the type being read. ## Strategy Selection Different types use different reconstruction strategies: - **`Vec `:** Parallel reconstruction across shards (see [`ChunkN

Source from the content-addressed store, hash-verified

294/// # Ok::<(), parcode::ParcodeError>(())
295/// ```
296pub trait ParcodeNative: Sized {
297 /// Reconstructs the object from the given graph node.
298 ///
299 /// This method is called by [`Parcode::load`](crate::Parcode::load) after opening the
300 /// file and locating the root chunk. Implementations should choose the most efficient
301 /// reconstruction strategy for their type.
302 ///
303 /// ## Parameters
304 ///
305 /// * `node`: The chunk node to reconstruct from (typically the root node)
306 ///
307 /// ## Returns
308 ///
309 /// The fully reconstructed object of type `Self`.
310 ///
311 /// ## Errors
312 ///
313 /// Returns an error if:
314 /// - Decompression fails
315 /// - Deserialization fails (type mismatch, corrupted data)
316 /// - Child nodes are missing or invalid
317 fn from_node(node: &ChunkNode<'_>) -> Result<Self>;
318}
319
320/// A trait for types that can be read from a shard (payload + children).
321///

Callers

nothing calls this directly

Implementers 1

reader.rssrc/reader.rs

Calls

no outgoing calls

Tested by

no test coverage detected