#![allow(clippy::needless_doctest_main)]
#![deny(missing_docs, missing_debug_implementations)]
mod api;
pub use api::{
AddError, Builder, CustomizeConnection, ErrorSink, ManageConnection, NopErrorSink, Pool,
PooledConnection, QueueStrategy, RunError, State, Statistics,
};
mod inner;
mod internals;
mod lock {
#[cfg(feature = "parking_lot")]
use parking_lot::Mutex as MutexImpl;
#[cfg(feature = "parking_lot")]
use parking_lot::MutexGuard;
#[cfg(not(feature = "parking_lot"))]
use std::sync::Mutex as MutexImpl;
#[cfg(not(feature = "parking_lot"))]
use std::sync::MutexGuard;
pub(crate) struct Mutex<T>(MutexImpl<T>);
impl<T> Mutex<T> {
pub(crate) fn new(val: T) -> Self {
Self(MutexImpl::new(val))
}
pub(crate) fn lock(&self) -> MutexGuard<'_, T> {
#[cfg(feature = "parking_lot")]
{
self.0.lock()
}
#[cfg(not(feature = "parking_lot"))]
{
self.0.lock().unwrap()
}
}
}
}