pub fn with_capacity<T, N, M>(min_items: usize) -> Result<Writer<T, N, M>, CircularError>
    where
        N: Notifier,
        M: Metadata,
    {
        let buffer = match DoubleMappedBuffer::new(min_items) {
            Ok(buffer) => Arc::new(buffer),
            Err(_) => return Err(CircularError::Allocation),
        };

        let state = Arc::new(Mutex::new(State {
            writer_offset: 0,
            writer_ab: false,
            writer_done: false,
            readers: Slab::new(),
        }));

        let writer = Writer {
            buffer,
            state,
            last_space: 0,
        };

        Ok(writer)
    }
/// Create a buffer that can hold at least `min_items` items of type `T`.
///
/// The size is the least common multiple of the page size and the size of `T`.
Create a buffer that can hold at least `min_items` items of type `T`.
The size is the least common multiple of the page size and the size of `T`.
Create a buffer that can hold at least ` min_items ` items of type ` T ` . The size is the least common multiple of the page size and the size of ` T ` .
pub fn with_capacity<T, N, M>(min_items: usize) -> Result<Writer<T, N, M>, CircularError>
    where
        N: Notifier,
        M: Metadata,
    {
        let buffer = match DoubleMappedBuffer::new(min_items) {
            Ok(buffer) => Arc::new(buffer),
            Err(_) => return Err(CircularError::Allocation),
        };
        let state = Arc::new(Mutex::new(State {
            writer_offset: 0,
            writer_ab: false,
            writer_done: false,
            readers: Slab::new(),
        }));
        let writer = Writer {
            buffer,
            state,
            last_space: 0,
        };
        Ok(writer)
    }
pub fn with_capacity < T , N , M > ( min_items : usize ) -> Result < Writer < T , N , M > , CircularError > where N : Notifier , M : Metadata , { let buffer = match DoubleMappedBuffer :: new ( min_items ) { Ok ( buffer ) => Arc :: new ( buffer ) , Err ( _ ) => return Err ( CircularError :: Allocation ) , } ; let state = Arc :: new ( Mutex :: new ( State { writer_offset : 0 , writer_ab : false , writer_done : false , readers : Slab :: new ( ) , } ) ) ; let writer = Writer { buffer , state , last_space : 0 , } ; Ok ( writer ) }
Create a buffer that can hold at least `min_items` items of type `T`.
Create a buffer that can hold at least ` min_items ` items of type ` T ` .
min_items
usize
min_items
usize