pub struct EngineSnapshot {Show 13 fields
pub magic: [u8; 8],
pub version: u32,
pub arch_id: String,
pub model_path: String,
pub tokenizer_path: Option<String>,
pub model_fingerprint: ModelFingerprint,
pub tokens: Vec<u32>,
pub sequence_state: SequenceStatePayload,
pub sampler_state: SamplerStatePayload,
pub grammar_state: Option<GrammarStatePayload>,
pub max_context_length: usize,
pub num_threads: usize,
pub prefill_chunk_size: usize,
}Expand description
The complete engine snapshot — opaque to callers outside this module.
Callers should treat the serialized form as opaque bytes: construct via
InferenceEngine::snapshot(), persist however is appropriate, then pass
the bytes to InferenceEngine::resume().
Fields§
§magic: [u8; 8]Magic bytes: must equal SNAPSHOT_MAGIC.
version: u32Format version. Current: EngineSnapshot::VERSION.
arch_id: StringArchitecture identifier (e.g. "llama", "qwen3", …).
model_path: StringAbsolute path to the model file at snapshot time.
tokenizer_path: Option<String>Optional explicit tokenizer path (None = auto-detect).
model_fingerprint: ModelFingerprintBounded fingerprint of the model file.
tokens: Vec<u32>All token IDs processed so far (prompt + generated).
sequence_state: SequenceStatePayloadSequence / KV state at snapshot time.
sampler_state: SamplerStatePayloadSampler state at snapshot time.
grammar_state: Option<GrammarStatePayload>Optional grammar state (None when no grammar is configured).
max_context_length: usizeMaximum context length the engine was configured with.
num_threads: usizeNumber of parallel inference threads.
prefill_chunk_size: usizePrefill chunk size.
Implementations§
Source§impl EngineSnapshot
impl EngineSnapshot
Sourcepub fn serialize(&self) -> RuntimeResult<Vec<u8>>
pub fn serialize(&self) -> RuntimeResult<Vec<u8>>
Serialize this snapshot to bytes using oxicode.
Sourcepub fn deserialize(bytes: &[u8]) -> RuntimeResult<Self>
pub fn deserialize(bytes: &[u8]) -> RuntimeResult<Self>
Deserialize a snapshot from bytes.
Returns SnapshotIncompatible if the bytes cannot be decoded, the
magic is wrong, or the version is not supported.
Trait Implementations§
Source§impl Clone for EngineSnapshot
impl Clone for EngineSnapshot
Source§fn clone(&self) -> EngineSnapshot
fn clone(&self) -> EngineSnapshot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EngineSnapshot
impl Debug for EngineSnapshot
Source§impl Decode for EngineSnapshot
impl Decode for EngineSnapshot
Auto Trait Implementations§
impl Freeze for EngineSnapshot
impl RefUnwindSafe for EngineSnapshot
impl Send for EngineSnapshot
impl Sync for EngineSnapshot
impl Unpin for EngineSnapshot
impl UnsafeUnpin for EngineSnapshot
impl UnwindSafe for EngineSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more