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

Method to_bytes

atomic-core/src/output/traits.rs:153–166  ·  view source on GitHub ↗

Encode metadata to bytes for storage. Format: [permissions_lo, permissions_hi, flags]

(&self)

Source from the content-addressed store, hash-verified

151 ///
152 /// Format: [permissions_lo, permissions_hi, flags]
153 pub fn to_bytes(&self) -> [u8; 3] {
154 let flags = if self.is_dir {
155 0x01
156 } else if self.is_symlink {
157 0x02
158 } else {
159 0x00
160 };
161 [
162 (self.permissions & 0xFF) as u8,
163 ((self.permissions >> 8) & 0xFF) as u8,
164 flags,
165 ]
166 }
167
168 /// Decode metadata from bytes.
169 pub fn from_bytes(bytes: &[u8]) -> Option<Self> {

Callers 1

Calls

no outgoing calls

Tested by 1