viceroy_lib/wiggle_abi/
config_store.rs1use super::{
2 fastly_config_store::FastlyConfigStore,
3 fastly_dictionary::FastlyDictionary,
4 types::{ConfigStoreHandle, DictionaryHandle},
5};
6use crate::{session::Session, Error};
7use wiggle::{GuestMemory, GuestPtr};
8
9impl FastlyConfigStore for Session {
10 fn open(
11 &mut self,
12 memory: &mut GuestMemory<'_>,
13 name: GuestPtr<str>,
14 ) -> Result<ConfigStoreHandle, Error> {
15 let dict_answer = <Self as FastlyDictionary>::open(self, memory, name)?;
16 Ok(ConfigStoreHandle::from(unsafe { dict_answer.inner() }))
17 }
18
19 fn get(
20 &mut self,
21 memory: &mut GuestMemory<'_>,
22 config_store: ConfigStoreHandle,
23 key: GuestPtr<str>,
24 buf: GuestPtr<u8>,
25 buf_len: u32,
26 nwritten_out: GuestPtr<u32>,
27 ) -> Result<(), Error> {
28 let dict_handle = DictionaryHandle::from(unsafe { config_store.inner() });
29 <Self as FastlyDictionary>::get(self, memory, dict_handle, key, buf, buf_len, nwritten_out)
30 }
31}