Skip to content

Commit

Permalink
Derive Default for QueueStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Aug 11, 2023
1 parent 272240d commit 6908d2f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions bb8/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,19 @@ pub struct Builder<M: ManageConnection> {
}

/// bb8's queue strategy when getting pool resources
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Default, Clone, Copy)]
pub enum QueueStrategy {
/// First in first out
/// This strategy behaves like a queue
/// It will evenly spread load on all existing connections, resetting their idle timeouts, maintaining the pool size
#[default]
Fifo,
/// Last in first out
/// This behaves like a stack
/// It will use the most recently used connection and help to keep the total pool size small by evicting idle connections
Lifo,
}

impl Default for QueueStrategy {
fn default() -> Self {
QueueStrategy::Fifo
}
}

impl<M: ManageConnection> Default for Builder<M> {
fn default() -> Self {
Builder {
Expand Down

0 comments on commit 6908d2f

Please sign in to comment.