You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: stream.rs
    path of file: ./repos/runng/runng/src/asyncio
    
    the code of the file until where you have to start completion: //! Byte streams.

use super::*;
use log::trace;
use runng_derive::{NngGetOpts, NngSetOpts};
use std::ptr;

/// Byte stream corresponding to TCP, UNIX domain socket, named pipe, etc. connection.
/// Wraps `nng_stream`
#[derive(Debug, NngGetOpts, NngSetOpts)]
#[prefix = "nng_stream_"]
pub struct NngStream {
    stream: *mut nng_stream,
}

/// List of scather/
    
    fn finish(&mut self, aio: &NngAio) {
        unsafe {
            let res = aio.result();
            let res = match res {
                Ok(()) => {
                    let ptr = aio.get_output(0);
                    let stream = NngStream {
                        stream: ptr as *mut nng_stream,
                    };
                    Ok(stream)
                }
                Err(err) => Err(err),
            };
            if let Err(err) = self.1.take().unwrap().send(res) {
                debug!("Finish failed: {:?}", err);
            }
        }
    }