Skip to content

Commit

Permalink
Include the DoubleMappepBufferError in the Allocation error.
Browse files Browse the repository at this point in the history
  • Loading branch information
basicinside authored and bastibl committed Sep 1, 2023
1 parent 3d03515 commit debe164
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use slab::Slab;
use std::sync::{Arc, Mutex};
use thiserror::Error;

use crate::double_mapped_buffer::DoubleMappedBuffer;
use crate::double_mapped_buffer::{DoubleMappedBuffer, DoubleMappedBufferError};

/// Error setting up the underlying buffer.
#[derive(Error, Debug)]
pub enum CircularError {
/// Failed to allocate double mapped buffer.
#[error("Failed to allocate double mapped buffer.")]
Allocation,
Allocation(DoubleMappedBufferError),
}

/// A custom notifier can be used to trigger arbitrary mechanism to signal to a
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Circular {
{
let buffer = match DoubleMappedBuffer::new(min_items) {
Ok(buffer) => Arc::new(buffer),
Err(_) => return Err(CircularError::Allocation),
Err(e) => return Err(CircularError::Allocation(e)),
};

let state = Arc::new(Mutex::new(State {
Expand Down

0 comments on commit debe164

Please sign in to comment.