pub fn build(self) -> io::Result<Stream<M>>
    where
        M: 'static + Send,
        F: 'static + RenderFn<M> + Send,
        R: 'static + raw::RenderFn<M> + Send,
    {
        let Builder {
            api_inner,
            builder,
            model,
            render,
            process_raw,
            frame_hz,
            interpolation_conf,
        } = self;

        // Retrieve the interpolation configuration.
        let interpolation_conf = interpolation_conf.build();
        // Retrieve the frame rate to initialise the stream with.
        let frame_hz = frame_hz.unwrap_or(stream::DEFAULT_FRAME_HZ);

        // The type used for buffering frames and using them to serve points to the raw stream.
        let requester = Requester { last_frame_point: None, raw_points: vec![] };
        let requester = Arc::new(Mutex::new(requester));

        // A channel for updating the interpolation config.
        let (state_update_tx, state_update_rx) = mpsc::channel();
        let state_update_tx: mpsc::Sender<StateUpdate> = state_update_tx;

        // State to live on the stream thread.
        let state = Arc::new(Mutex::new(State { frame_hz, interpolation_conf }));

        // A render function for the inner raw stream.
        let raw_render = move |model: &mut M, buffer: &mut Buffer| {
            // Check for updates and retrieve a copy of the state.
            let state = {
                let mut state = state.lock().expect("failed to lock");
                for mut state_update in state_update_rx.try_iter() {
                    (*state_update)(&mut state);
                }
                state.clone()
            };

            let mut guard = requester.lock().expect("failed to lock frame requester");
            guard.fill_buffer(model, &render, buffer, &state);
            process_raw(model, buffer);
        };

        // Create the raw builder and build the raw stream.
        let raw_builder = raw::Builder { api_inner, builder, model, render: raw_render };
        let raw_stream = raw_builder.build()?;
        let stream = Stream { raw: raw_stream, state_update_tx };
        Ok(stream)
    }
/// Build the stream with the specified parameters.
///
/// **Note:** If no `dac` was specified, this will method will block until a DAC is detected.
/// The first detected DAC is the DAC with which a stream will be established.
Build the stream with the specified parameters.
Note:** If no `dac` was specified, this will method will block until a DAC is detected.
The first detected DAC is the DAC with which a stream will be established.
Build the stream with the specified parameters . Note : ** If no ` dac ` was specified this will method will block until a DAC is detected . The first detected DAC is the DAC with which a stream will be established .
pub fn build(self) -> io::Result<Stream<M>>
    where
        M: 'static + Send,
        F: 'static + RenderFn<M> + Send,
        R: 'static + raw::RenderFn<M> + Send,
    {
        let Builder {
            api_inner,
            builder,
            model,
            render,
            process_raw,
            frame_hz,
            interpolation_conf,
        } = self;
        // Retrieve the interpolation configuration.
        let interpolation_conf = interpolation_conf.build();
        // Retrieve the frame rate to initialise the stream with.
        let frame_hz = frame_hz.unwrap_or(stream::DEFAULT_FRAME_HZ);
        // The type used for buffering frames and using them to serve points to the raw stream.
        let requester = Requester { last_frame_point: None, raw_points: vec![] };
        let requester = Arc::new(Mutex::new(requester));
        // A channel for updating the interpolation config.
        let (state_update_tx, state_update_rx) = mpsc::channel();
        let state_update_tx: mpsc::Sender<StateUpdate> = state_update_tx;
        // State to live on the stream thread.
        let state = Arc::new(Mutex::new(State { frame_hz, interpolation_conf }));
        // A render function for the inner raw stream.
        let raw_render = move |model: &mut M, buffer: &mut Buffer| {
            // Check for updates and retrieve a copy of the state.
            let state = {
                let mut state = state.lock().expect("failed to lock");
                for mut state_update in state_update_rx.try_iter() {
                    (*state_update)(&mut state);
                }
                state.clone()
            };
            let mut guard = requester.lock().expect("failed to lock frame requester");
            guard.fill_buffer(model, &render, buffer, &state);
            process_raw(model, buffer);
        };
        // Create the raw builder and build the raw stream.
        let raw_builder = raw::Builder { api_inner, builder, model, render: raw_render };
        let raw_stream = raw_builder.build()?;
        let stream = Stream { raw: raw_stream, state_update_tx };
        Ok(stream)
    }
pub fn build ( self ) -> io :: Result < Stream < M > > where M : ' static + Send , F : ' static + RenderFn < M > + Send , R : ' static + raw :: RenderFn < M > + Send , { let Builder { api_inner , builder , model , render , process_raw , frame_hz , interpolation_conf , } = self ; // Retrieve the interpolation configuration. let interpolation_conf = interpolation_conf . build ( ) ; // Retrieve the frame rate to initialise the stream with. let frame_hz = frame_hz . unwrap_or ( stream :: DEFAULT_FRAME_HZ ) ; // The type used for buffering frames and using them to serve points to the raw stream. let requester = Requester { last_frame_point : None , raw_points : vec ! [ ] } ; let requester = Arc :: new ( Mutex :: new ( requester ) ) ; // A channel for updating the interpolation config. let ( state_update_tx , state_update_rx ) = mpsc :: channel ( ) ; let state_update_tx : mpsc :: Sender < StateUpdate > = state_update_tx ; // State to live on the stream thread. let state = Arc :: new ( Mutex :: new ( State { frame_hz , interpolation_conf } ) ) ; // A render function for the inner raw stream. let raw_render = move | model : & mut M , buffer : & mut Buffer | { // Check for updates and retrieve a copy of the state. let state = { let mut state = state . lock ( ) . expect ( " " ) ; for mut state_update in state_update_rx . try_iter ( ) { ( * state_update ) ( & mut state ) ; } state . clone ( ) } ; let mut guard = requester . lock ( ) . expect ( " " ) ; guard . fill_buffer ( model , & render , buffer , & state ) ; process_raw ( model , buffer ) ; } ; // Create the raw builder and build the raw stream. let raw_builder = raw :: Builder { api_inner , builder , model , render : raw_render } ; let raw_stream = raw_builder . build ( ) ? ; let stream = Stream { raw : raw_stream , state_update_tx } ; Ok ( stream ) }
Build the stream with the specified parameters.
Build the stream with the specified parameters .
self
self