MCPcopy Create free account
hub / github.com/Starry-OS/StarryOS / get_as_slice

Method get_as_slice

api/src/mm.rs:196–203  ·  view source on GitHub ↗
(self, len: usize)

Source from the content-addressed store, hash-verified

194 }
195
196 pub fn get_as_slice(self, len: usize) -> AxResult<&'static [T]> {
197 check_region(
198 self.address(),
199 Layout::array::<T>(len).unwrap(),
200 Self::ACCESS_FLAGS,
201 )?;
202 Ok(unsafe { slice::from_raw_parts(self.0, len) })
203 }
204
205 pub fn get_as_null_terminated(self) -> AxResult<&'static [T]>
206 where

Callers 2

read_from_userMethod · 0.80
parseMethod · 0.80

Calls 2

check_regionFunction · 0.85
addressMethod · 0.80

Tested by

no test coverage detected