pub struct WalPoolBuilder {
pub readers: usize,
pub reader_setup: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>,
pub writer_setup: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>,
}Expand description
A builder for a WalPool.
Fields§
§readers: usizeThe number of read connections
reader_setup: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>A function to be called to initialize each reader.
writer_setup: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>A function to be called to initialize the writer.
Implementations§
Source§impl WalPoolBuilder
impl WalPoolBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Make a new WalPoolBuilder.
Sourcepub fn readers(&mut self, readers: usize) -> &mut Self
pub fn readers(&mut self, readers: usize) -> &mut Self
Set the number of read connections.
This must be greater than 0.
Sourcepub fn reader_setup<F>(&mut self, reader_setup: F) -> &mut Self
pub fn reader_setup<F>(&mut self, reader_setup: F) -> &mut Self
Add a function to be called when a reader connection initializes.
Sourcepub fn writer_setup<F>(&mut self, writer_setup: F) -> &mut Self
pub fn writer_setup<F>(&mut self, writer_setup: F) -> &mut Self
Add a function to be called when the writer connection initializes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WalPoolBuilder
impl !RefUnwindSafe for WalPoolBuilder
impl Send for WalPoolBuilder
impl Sync for WalPoolBuilder
impl Unpin for WalPoolBuilder
impl !UnwindSafe for WalPoolBuilder
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