dope_sys/memory/buffer/pool.rs
1use std::convert::Infallible;
2
3use o3::buffer::{self, pool};
4
5use crate::memory::{self, buffer::Recycle};
6
7/// A native receive pool paired with its exact projection context.
8pub trait Pool: Sized {
9 type Layout: memory::raw::Layout;
10 type Buffer: crate::Buffer + Recycle<Deferred = Infallible>;
11 type Context: memory::Context<Layout = Self::Layout> + buffer::raw::Fixed<Self::Buffer>;
12
13 fn try_new(layout: Self::Layout) -> Result<(Self, Self::Context), pool::CreateError>;
14 fn take(&self) -> Option<Self::Buffer>;
15}