mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
core: Add Completion.complete() helper
This commit is contained in:
parent
2724b0f411
commit
93670b0505
3 changed files with 17 additions and 2 deletions
|
@ -1,8 +1,21 @@
|
|||
use cfg_block::cfg_block;
|
||||
use std::{mem::ManuallyDrop, pin::Pin, sync::Arc};
|
||||
|
||||
pub type Complete = dyn Fn(&Buffer) + Send + Sync;
|
||||
|
||||
pub struct Completion {
|
||||
pub buf: Buffer,
|
||||
pub complete: Box<Complete>,
|
||||
}
|
||||
|
||||
impl Completion {
|
||||
pub fn new(buf: Buffer, complete: Box<Complete>) -> Self {
|
||||
Self { buf, complete }
|
||||
}
|
||||
|
||||
pub fn complete(&self) {
|
||||
(self.complete)(&self.buf);
|
||||
}
|
||||
}
|
||||
|
||||
pub type BufferData = Pin<Vec<u8>>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue