MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / deserialize

Method deserialize

atomic-core/src/change/format_v3/reader/mod.rs:158–160  ·  view source on GitHub ↗

Deserialize the payload from postcard format. Convenience wrapper around [`postcard::from_bytes`] that handles the error conversion. # Type Parameters `T` - The target type, must implement `serde::Deserialize`. # Errors - `FormatError::Postcard` if deserialization fails. # Examples ```rust,ignore use atomic_core::change::ChangeHeader; let header: ChangeHeader = section.deserialize()?; ```

(&'de self)

Source from the content-addressed store, hash-verified

156 /// let header: ChangeHeader = section.deserialize()?;
157 /// ```
158 pub fn deserialize<'de, T: serde::Deserialize<'de>>(&'de self) -> FormatResult<T> {
159 Ok(postcard::from_bytes(&self.payload)?)
160 }
161
162 /// Returns `true` if this is a hashed section (contributes to content hash).
163 #[inline]

Calls

no outgoing calls