pub struct PrefixCacheSnapshot {
pub block_size: usize,
pub entries: Vec<PrefixSnapshotEntry>,
}Expand description
A serialized snapshot of warm prefix cache blocks for instant cold-start loading across restarts.
Fields§
§block_size: usizeSize of each physical block in tokens.
entries: Vec<PrefixSnapshotEntry>Collection of cached prefix entries.
Implementations§
Source§impl PrefixCacheSnapshot
impl PrefixCacheSnapshot
pub fn new(block_size: usize) -> PrefixCacheSnapshot
Sourcepub fn to_json(&self) -> Result<String, CacheError>
pub fn to_json(&self) -> Result<String, CacheError>
Serializes the snapshot to a JSON string.
Sourcepub fn from_json(json_str: &str) -> Result<PrefixCacheSnapshot, CacheError>
pub fn from_json(json_str: &str) -> Result<PrefixCacheSnapshot, CacheError>
Deserializes a snapshot from a JSON string.
Trait Implementations§
Source§impl Clone for PrefixCacheSnapshot
impl Clone for PrefixCacheSnapshot
Source§fn clone(&self) -> PrefixCacheSnapshot
fn clone(&self) -> PrefixCacheSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrefixCacheSnapshot
impl Debug for PrefixCacheSnapshot
Source§impl<'de> Deserialize<'de> for PrefixCacheSnapshot
impl<'de> Deserialize<'de> for PrefixCacheSnapshot
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PrefixCacheSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PrefixCacheSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PrefixCacheSnapshot
Source§impl PartialEq for PrefixCacheSnapshot
impl PartialEq for PrefixCacheSnapshot
Source§impl Serialize for PrefixCacheSnapshot
impl Serialize for PrefixCacheSnapshot
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for PrefixCacheSnapshot
Auto Trait Implementations§
impl Forget for PrefixCacheSnapshot
impl Freeze for PrefixCacheSnapshot
impl Move for PrefixCacheSnapshot
impl RefUnwindSafe for PrefixCacheSnapshot
impl Send for PrefixCacheSnapshot
impl Sync for PrefixCacheSnapshot
impl Unpin for PrefixCacheSnapshot
impl UnsafeUnpin for PrefixCacheSnapshot
impl UnwindSafe for PrefixCacheSnapshot
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