rig_core/operation/
cached_content.rs1use crate::error::ProviderError;
13use crate::providers::gemini::cached_content::{CachedContentReply, CachedContentRequest};
14use crate::wire::{Call, Fold, Free, Operation, Reply};
15
16#[derive(Debug, Clone, Copy, PartialEq, Eq)]
19pub struct ContextCache;
20
21impl Operation for ContextCache {
22 type Request = CachedContentRequest;
23 type Event = std::convert::Infallible;
24 type End = CachedContentReply;
25 type Response = CachedContentReply;
26 type Fold = CachedContentFold;
27 type Emit = Free;
28
29 fn fold(_request: &Self::Request, _call: &mut Call<'_>) -> Self::Fold {
30 CachedContentFold
31 }
32}
33
34#[derive(Default)]
37pub struct CachedContentFold;
38
39impl Fold<ContextCache> for CachedContentFold {
40 fn absorb(&mut self, event: &std::convert::Infallible) -> Result<(), ProviderError> {
41 match *event {}
42 }
43
44 fn finish(
45 self,
46 end: CachedContentReply,
47 _reply: Reply,
48 ) -> Result<CachedContentReply, ProviderError> {
49 Ok(end)
50 }
51}