fn buffer() {
    let (sink, allow) = manual_allow::<i32>();
    let sink = sink.buffer(2);

    let sink = block_on(StartSendFut::new(sink, 0)).unwrap();
    let sink = block_on(StartSendFut::new(sink, 1)).unwrap();

    flag_cx(|flag, cx| {
        let mut task = sink.send(2);
        assert!(task.poll(cx).unwrap().is_pending());
        assert!(!flag.get());
        allow.start();
        assert!(flag.get());
        match task.poll(cx).unwrap() {
            Poll::Ready(sink) => {
                assert_eq!(sink.get_ref().data, vec![0, 1, 2]);
            }
            _ => panic!()
        }
    })
}
// test basic buffer functionality, including both filling up to capacity,
// and writing out when the underlying sink is ready
test basic buffer functionality, including both filling up to capacity,
and writing out when the underlying sink is ready
test basic buffer functionality including both filling up to capacity and writing out when the underlying sink is ready
fn buffer() {
    let (sink, allow) = manual_allow::<i32>();
    let sink = sink.buffer(2);
    let sink = block_on(StartSendFut::new(sink, 0)).unwrap();
    let sink = block_on(StartSendFut::new(sink, 1)).unwrap();
    flag_cx(|flag, cx| {
        let mut task = sink.send(2);
        assert!(task.poll(cx).unwrap().is_pending());
        assert!(!flag.get());
        allow.start();
        assert!(flag.get());
        match task.poll(cx).unwrap() {
            Poll::Ready(sink) => {
                assert_eq!(sink.get_ref().data, vec![0, 1, 2]);
            }
            _ => panic!()
        }
    })
}
fn buffer ( ) { let ( sink , allow ) = manual_allow :: < i32 > ( ) ; let sink = sink . buffer ( 2 ) ; let sink = block_on ( StartSendFut :: new ( sink , 0 ) ) . unwrap ( ) ; let sink = block_on ( StartSendFut :: new ( sink , 1 ) ) . unwrap ( ) ; flag_cx ( | flag , cx | { let mut task = sink . send ( 2 ) ; assert ! ( task poll ( cx ) unwrap ( ) is_pending ( ) ) ; assert ! ( flag get ( ) ) ; allow . start ( ) ; assert ! ( flag get ( ) ) ; match task . poll ( cx ) . unwrap ( ) { Poll :: Ready ( sink ) => { assert_eq ! ( sink get_ref ( ) data vec [ 0 1 2 ] ) ; } _ => panic ! ( ) } } ) }
test basic buffer functionality, including both filling up to capacity,
and writing out when the underlying sink is ready
test basic buffer functionality including both filling up to capacity and writing out when the underlying sink is ready