pub struct WalPoolBuilder {
pub num_read_connections: usize,
pub reader_init_fn: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>,
pub writer_init_fn: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>,
}
Expand description
A builder for a WalPool
.
Fields§
§num_read_connections: usize
The number of read connections
reader_init_fn: Option<Arc<dyn Fn(&mut Connection) -> Result<(), Error> + Send + Sync + 'static>>
A function to be called to initialize each reader.
writer_init_fn: 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 num_read_connections(&mut self, num_read_connections: usize) -> &mut Self
pub fn num_read_connections(&mut self, num_read_connections: usize) -> &mut Self
Set the number of read connections.
This must be greater than 0.
Sourcepub fn writer_init_fn<F>(&mut self, writer_init_fn: F) -> &mut Self
pub fn writer_init_fn<F>(&mut self, writer_init_fn: F) -> &mut Self
Add a function to be called when the writer connection initializes.
Sourcepub fn reader_init_fn<F>(&mut self, reader_init_fn: F) -> &mut Self
pub fn reader_init_fn<F>(&mut self, reader_init_fn: F) -> &mut Self
Add a function to be called when a reader 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