MCPcopy Create free account
hub / github.com/Rustixir/darkbird / insert

Method insert

src/darkbird/database.rs:174–195  ·  view source on GitHub ↗
(&self, key: K, doc: Doc)

Source from the content-addressed store, hash-verified

172
173 #[inline]
174 pub async fn insert<K, Doc>(&self, key: K, doc: Doc) -> Result<(), SessionResult>
175 where
176 Doc: Serialize + DeserializeOwned + Clone + Send + 'static + Document,
177 K: Serialize
178 + DeserializeOwned
179 + PartialOrd
180 + Ord
181 + PartialEq
182 + Eq
183 + Hash
184 + Clone
185 + Send
186 + Sync
187 + 'static
188 {
189 match self.datastores.get::<Storage<K, Doc>>() {
190 None => Err(SessionResult::DataStoreNotFound),
191 Some(datastore) => {
192 datastore.insert(key, doc).await
193 }
194 }
195 }
196
197 #[inline]
198 pub async fn remove<K, Doc>(&self, key: K) -> Result<(), SessionResult>

Callers 1

vec_insertMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected