pub struct BuilderPool { /* private fields */ }Expand description
A pool of reusable builders for high-throughput scenarios.
This is useful when building many queries concurrently, as it allows reusing allocated buffers across requests.
§Example
use prax_query::builder::BuilderPool;
let pool = BuilderPool::new(16, 256); // 16 builders, 256 byte capacity each
// Get a builder from the pool
let mut builder = pool.get();
builder.push("SELECT * FROM users");
let sql = builder.take();
pool.put(builder); // Return to pool for reuseImplementations§
Source§impl BuilderPool
impl BuilderPool
Sourcepub fn new(pool_size: usize, builder_capacity: usize) -> Self
pub fn new(pool_size: usize, builder_capacity: usize) -> Self
Create a new pool with the specified size and builder capacity.
Sourcepub fn get(&self) -> ReusableBuilder
pub fn get(&self) -> ReusableBuilder
Get a builder from the pool, or create a new one if empty.
Sourcepub fn put(&self, builder: ReusableBuilder)
pub fn put(&self, builder: ReusableBuilder)
Return a builder to the pool for reuse.
Auto Trait Implementations§
impl !Freeze for BuilderPool
impl !RefUnwindSafe for BuilderPool
impl Send for BuilderPool
impl Sync for BuilderPool
impl Unpin for BuilderPool
impl UnwindSafe for BuilderPool
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