Skip to main content

SharedCacheResp

Enum SharedCacheResp 

Source
#[non_exhaustive]
pub enum SharedCacheResp<V = CachedAnswer> { Hit { value: V, score: f32, embedding: Vec<f32>, }, Miss { best: Option<f32>, }, Stored, Removed { count: u64, }, Exact { value: Option<Vec<u8>>, }, Pong { entries: u64, }, Error { message: String, }, }
Expand description

The answer to a SharedCacheReq.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Hit

A Lookup reached the threshold. embedding is the stored entry’s (normalized), so the asker can keep a local copy under the same direction.

Fields

§value: V
§score: f32
§embedding: Vec<f32>
§

Miss

A Lookup found nothing at the threshold; best is the best score below it.

Fields

§best: Option<f32>
§

Stored

An insert or exact put was taken (a store may still drop it at any time).

§

Removed

A removal; count entries went.

Fields

§count: u64
§

Exact

Fields

§value: Option<Vec<u8>>
§

Pong

A Ping; entries is the node’s semantic entry count.

Fields

§entries: u64
§

Error

The node refused or couldn’t serve the request (bad input, no exact store, not authorized, an unknown request from a newer version).

Fields

§message: String

Implementations§

Source§

impl<V> SharedCacheResp<V>

Source

pub fn error(message: impl Into<String>) -> Self

Source§

impl<V: Serialize> SharedCacheResp<V>

Source

pub fn encode(&self) -> Result<Vec<u8>, RemoteError>

CBOR, with the WIRE_VERSION.

Source§

impl<V: DeserializeOwned> SharedCacheResp<V>

Source

pub fn decode(bytes: &[u8]) -> Result<Self, RemoteError>

Trait Implementations§

Source§

impl<V: Clone> Clone for SharedCacheResp<V>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug> Debug for SharedCacheResp<V>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de, V> Deserialize<'de> for SharedCacheResp<V>
where V: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<V: PartialEq> PartialEq for SharedCacheResp<V>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<V> Serialize for SharedCacheResp<V>
where V: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<V: PartialEq> StructuralPartialEq for SharedCacheResp<V>

Auto Trait Implementations§

§

impl<V> Forget for SharedCacheResp<V>

§

impl<V> Freeze for SharedCacheResp<V>
where V: Freeze,

§

impl<V> Move for SharedCacheResp<V>

§

impl<V> RefUnwindSafe for SharedCacheResp<V>
where V: RefUnwindSafe,

§

impl<V> Send for SharedCacheResp<V>
where V: Send,

§

impl<V> Sync for SharedCacheResp<V>
where V: Sync,

§

impl<V> Unpin for SharedCacheResp<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for SharedCacheResp<V>
where V: UnsafeUnpin,

§

impl<V> UnwindSafe for SharedCacheResp<V>
where V: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.