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

Method from_bytes

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

Decode metadata from bytes.

(bytes: &[u8])

Source from the content-addressed store, hash-verified

167
168 /// Decode metadata from bytes.
169 pub fn from_bytes(bytes: &[u8]) -> Option<Self> {
170 if bytes.len() < 3 {
171 return None;
172 }
173 let permissions = u16::from(bytes[0]) | (u16::from(bytes[1]) << 8);
174 let (is_dir, is_symlink) = match bytes[2] {
175 0x01 => (true, false),
176 0x02 => (false, true),
177 _ => (false, false),
178 };
179 Some(Self {
180 permissions,
181 is_dir,
182 is_symlink,
183 })
184 }
185}
186
187// WORKING COPY READ TRAIT

Callers

nothing calls this directly

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected