pub struct MemoryTaskStore { /* private fields */ }Expand description
In-memory task store for testing
This store keeps all tasks in memory using a RwLock<Vec<Task>>.
It is thread-safe and can be used in async contexts.
§Example
use meerkat_tools::builtin::{MemoryTaskStore, TaskStore, NewTask};
let store = MemoryTaskStore::new();
let task = store.create(
NewTask {
subject: "Test task".to_string(),
description: "A test task".to_string(),
priority: None,
labels: None,
blocks: None,
},
None
).await.unwrap();
assert_eq!(store.list().await.unwrap().len(), 1);Implementations§
Source§impl MemoryTaskStore
impl MemoryTaskStore
Trait Implementations§
Source§impl Default for MemoryTaskStore
impl Default for MemoryTaskStore
Source§impl TaskStore for MemoryTaskStore
impl TaskStore for MemoryTaskStore
Source§fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all tasks in the store
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a single task by ID Read more
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
new_task: NewTask,
session_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
new_task: NewTask,
session_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new task Read more
Source§fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
update: TaskUpdate,
session_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
update: TaskUpdate,
session_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Task, TaskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Update an existing task Read more
Auto Trait Implementations§
impl !Freeze for MemoryTaskStore
impl !RefUnwindSafe for MemoryTaskStore
impl !UnwindSafe for MemoryTaskStore
impl Send for MemoryTaskStore
impl Sync for MemoryTaskStore
impl Unpin for MemoryTaskStore
impl UnsafeUnpin for MemoryTaskStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more