Skip to main content

GgufMmapBackend

Struct GgufMmapBackend 

Source
pub struct GgufMmapBackend { /* private fields */ }
Expand description

Checkpoint over a memory-mapped crate::GgufLayoutMmap.

Callers must not truncate the file while the backend is alive (standard mmap invariant).

Implementations§

Source§

impl GgufMmapBackend

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Map and parse a .gguf file with ParseLimits::default.

Source

pub fn open_with_limits( path: impl AsRef<Path>, limits: ParseLimits, ) -> Result<Self>

Map and parse a .gguf file with explicit limits.

Source

pub fn from_layout(layout: GgufLayoutMmap) -> Self

Wrap an already-mapped layout.

Source

pub fn layout(&self) -> &GgufLayoutMmap

Format-specific mapped layout (page-aligned views, directory checks).

Source

pub fn into_layout(self) -> GgufLayoutMmap

Unwrap into the format-specific mapped layout.

Trait Implementations§

Source§

impl Checkpoint for GgufMmapBackend

Available on crate feature mmap only.
Source§

fn source(&self) -> &CheckpointSource

Checkpoint identity: format, input path, root, payload files.
Source§

fn tensors(&self) -> &[TensorInfo]

Every tensor, sorted by name.
Source§

fn metadata(&self) -> &CheckpointMetadata

Scalar metadata.
Source§

fn tensor_bytes(&self, name: &str) -> Result<Cow<'_, [u8]>>

Raw payload bytes of name, length TensorInfo::byte_len.
Source§

fn format(&self) -> CheckpointFormat

Container format.
Source§

fn tensor(&self, name: &str) -> Option<&TensorInfo>

Look up one tensor by exact name.
Source§

impl Debug for GgufMmapBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for GgufMmapBackend

§

impl Freeze for GgufMmapBackend

§

impl Move for GgufMmapBackend

§

impl RefUnwindSafe for GgufMmapBackend

§

impl Send for GgufMmapBackend
where RawVecInner: Send, RawTable<(String, String)>: Send, RawTable<(String, u64)>: Send, RawTable<(String, i64)>: Send, RawTable<(String, f32)>: Send, RawTable<(String, f64)>: Send, RawTable<(String, Tensor)>: Send, MmapInner: Send, NodeRef<Owned, String, MetadataValue, LeafOrInternal>: Send, BoxRaw<(String, MetadataValue)>: Send,

§

impl Sync for GgufMmapBackend
where RawVecInner: Sync, RawTable<(String, String)>: Sync, RawTable<(String, u64)>: Sync, RawTable<(String, i64)>: Sync, RawTable<(String, f32)>: Sync, RawTable<(String, f64)>: Sync, RawTable<(String, Tensor)>: Sync, MmapInner: Sync, NodeRef<Owned, String, MetadataValue, LeafOrInternal>: Sync, BoxRaw<(String, MetadataValue)>: Sync,

§

impl Unpin for GgufMmapBackend

§

impl UnsafeUnpin for GgufMmapBackend

§

impl UnwindSafe for GgufMmapBackend

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.