pub struct MappedModelFile { /* private fields */ }Expand description
A read-only operating-system mapping of one model file.
Mapping avoids allocating a model-sized heap buffer and can be cloned cheaply so validated tensors retain ranges of the same operating-system mapping.
Implementations§
Source§impl MappedModelFile
impl MappedModelFile
Sourcepub unsafe fn open(path: &Path) -> Result<Self>
pub unsafe fn open(path: &Path) -> Result<Self>
Opens and maps a non-empty model file read-only.
§Safety
The underlying file must not be modified or truncated until this value and every clone derived from it have been dropped. File-backed mappings cannot enforce that condition against other processes.
§Errors
Returns an I/O error when the file cannot be opened, inspected, or mapped, or when it is empty.
Trait Implementations§
Source§impl Clone for MappedModelFile
impl Clone for MappedModelFile
Auto Trait Implementations§
impl Forget for MappedModelFile
impl Freeze for MappedModelFile
impl Move for MappedModelFile
impl RefUnwindSafe for MappedModelFile
impl Send for MappedModelFile
impl Sync for MappedModelFile
impl Unpin for MappedModelFile
impl UnsafeUnpin for MappedModelFile
impl UnwindSafe for MappedModelFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more