mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-08-01 04:38:31 +00:00
use smallvec for db query buffering
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
76c75cc05a
commit
3ad6aa59f9
23 changed files with 173 additions and 98 deletions
|
@ -9,23 +9,25 @@ use conduit::{
|
|||
use futures::FutureExt;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::ser;
|
||||
use crate::{keyval::KeyBuf, ser};
|
||||
|
||||
/// Returns true if the map contains the key.
|
||||
/// - key is serialized into allocated buffer
|
||||
/// - harder errors may not be reported
|
||||
#[inline]
|
||||
#[implement(super::Map)]
|
||||
pub fn contains<K>(self: &Arc<Self>, key: &K) -> impl Future<Output = bool> + Send + '_
|
||||
where
|
||||
K: Serialize + ?Sized + Debug,
|
||||
{
|
||||
let mut buf = Vec::<u8>::with_capacity(64);
|
||||
let mut buf = KeyBuf::new();
|
||||
self.bcontains(key, &mut buf)
|
||||
}
|
||||
|
||||
/// Returns true if the map contains the key.
|
||||
/// - key is serialized into stack-buffer
|
||||
/// - harder errors will panic
|
||||
#[inline]
|
||||
#[implement(super::Map)]
|
||||
pub fn acontains<const MAX: usize, K>(self: &Arc<Self>, key: &K) -> impl Future<Output = bool> + Send + '_
|
||||
where
|
||||
|
@ -51,6 +53,7 @@ where
|
|||
|
||||
/// Returns Ok if the map contains the key.
|
||||
/// - key is raw
|
||||
#[inline]
|
||||
#[implement(super::Map)]
|
||||
pub fn exists<'a, K>(self: &'a Arc<Self>, key: &K) -> impl Future<Output = Result> + Send + 'a
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue