pub fn stream(&self) -> impl Stream<Item=Draw>+Send {
        // Create a new canvas stream
        let new_core    = Arc::new(Desync::new(DrawStreamCore::new()));
        let new_stream  = DrawStream::with_core(&new_core);

        // Register it and send the current set of pending commands to it
        let add_stream = Arc::clone(&new_core);
        self.core.desync(move |core| {
            // Send the data we've received since the last clear
            add_stream.sync(|stream| {
                stream.write(iter::once(Draw::ResetFrame));
                stream.write(core.main_core.get_pending_drawing())
            });

            // Store the stream in the core so future notifications get sent there
            core.streams.push(Arc::downgrade(&add_stream));

            // Wake the stream if it's not awake
            add_stream.sync(|stream| stream.take_waker().map(|waker| waker.wake()));
        });

        // Return the new stream
        new_stream
    }
///
/// Creates a stream for reading the instructions from this canvas
///
Creates a stream for reading the instructions from this canvas
Creates a stream for reading the instructions from this canvas
pub fn stream(&self) -> impl Stream<Item=Draw>+Send {
        // Create a new canvas stream
        let new_core    = Arc::new(Desync::new(DrawStreamCore::new()));
        let new_stream  = DrawStream::with_core(&new_core);
        // Register it and send the current set of pending commands to it
        let add_stream = Arc::clone(&new_core);
        self.core.desync(move |core| {
            // Send the data we've received since the last clear
            add_stream.sync(|stream| {
                stream.write(iter::once(Draw::ResetFrame));
                stream.write(core.main_core.get_pending_drawing())
            });
            // Store the stream in the core so future notifications get sent there
            core.streams.push(Arc::downgrade(&add_stream));
            // Wake the stream if it's not awake
            add_stream.sync(|stream| stream.take_waker().map(|waker| waker.wake()));
        });
        // Return the new stream
        new_stream
    }
pub fn stream ( & self ) -> impl Stream < Item = Draw > + Send { // Create a new canvas stream let new_core = Arc :: new ( Desync :: new ( DrawStreamCore :: new ( ) ) ) ; let new_stream = DrawStream :: with_core ( & new_core ) ; // Register it and send the current set of pending commands to it let add_stream = Arc :: clone ( & new_core ) ; self . core . desync ( move | core | { // Send the data we've received since the last clear add_stream . sync ( | stream | { stream . write ( iter :: once ( Draw :: ResetFrame ) ) ; stream . write ( core . main_core . get_pending_drawing ( ) ) } ) ; // Store the stream in the core so future notifications get sent there core . streams . push ( Arc :: downgrade ( & add_stream ) ) ; // Wake the stream if it's not awake add_stream . sync ( | stream | stream . take_waker ( ) . map ( | waker | waker . wake ( ) ) ) ; } ) ; // Return the new stream new_stream }
Creates a stream for reading the instructions from this canvas
Creates a stream for reading the instructions from this canvas
&self