MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / from

Method from

src/allocator/mod.rs:228–245  ·  view source on GitHub ↗

From

(vec: Vec<u8>)

Source from the content-addressed store, hash-verified

226
227 // From
228 pub fn from(vec: Vec<u8>) -> Self
229 {
230 let bufferlen = vec.len() - 1;
231 let memlen = physaddr(&vec[bufferlen]) - physaddr(&vec[0]);
232
233 if bufferlen == memlen as usize
234 {
235 Self
236 {
237 buffer: Arc::new(Mutex::new(vec))
238 }
239 }
240 else
241 {
242 // If there is an error, clone the vector and retry
243 Self::from(vec.clone())
244 }
245 }
246
247
248 // New

Callers

nothing calls this directly

Calls 2

physaddrFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected