pub fn unload_scanning(&mut self) {
        use BgraOrRes as BOR;
        use ScanResult::*;

        let fut = std::mem::replace(
            &mut self.0,
            // This future should never, ever be waited on. It would mean we panicked between now
            // and the end of the function.
            async { unreachable!("Waited on an invalid ScanFuture") }.boxed(),
        );
        // The entire Manager runs inside a single LocalSet so this will not panic.
        let h = tokio::task::spawn_local(async move {
            let out = match fut.await {
                ConvertedImage(pb, BOR::Bgra(bgra)) => ConvertedImage(pb, bgra.0.res.into()),
                Image(BOR::Bgra(bgra)) => Image(bgra.0.res.into()),
                x => return x,
            };

            out
        });

        self.0 = h
            .map(|r| match r {
                Ok(r) => r,
                Err(e) => {
                    let e = format!("Unexpected error while unloading scanning page: {:?}", e);
                    error!("{}", e);
                    Invalid(e)
                }
            })
            .boxed()
    }
// In theory this can be called twice before scanning completes, but in practice it's not worth
// optimizing for.
In theory this can be called twice before scanning completes, but in practice it's not worth
optimizing for.
In theory this can be called twice before scanning completes but in practice it ' s not worth optimizing for .
pub fn unload_scanning(&mut self) {
        use BgraOrRes as BOR;
        use ScanResult::*;
        let fut = std::mem::replace(
            &mut self.0,
            // This future should never, ever be waited on. It would mean we panicked between now
            // and the end of the function.
            async { unreachable!("Waited on an invalid ScanFuture") }.boxed(),
        );
        // The entire Manager runs inside a single LocalSet so this will not panic.
        let h = tokio::task::spawn_local(async move {
            let out = match fut.await {
                ConvertedImage(pb, BOR::Bgra(bgra)) => ConvertedImage(pb, bgra.0.res.into()),
                Image(BOR::Bgra(bgra)) => Image(bgra.0.res.into()),
                x => return x,
            };
            out
        });
        self.0 = h
            .map(|r| match r {
                Ok(r) => r,
                Err(e) => {
                    let e = format!("Unexpected error while unloading scanning page: {:?}", e);
                    error!("{}", e);
                    Invalid(e)
                }
            })
            .boxed()
    }
pub fn unload_scanning ( & mut self ) { use BgraOrRes as BOR ; use ScanResult :: * ; let fut = std :: mem :: replace ( & mut self . 0 , // This future should never, ever be waited on. It would mean we panicked between now // and the end of the function. async { unreachable ! ( " " ) } . boxed ( ) , ) ; // The entire Manager runs inside a single LocalSet so this will not panic. let h = tokio :: task :: spawn_local ( async move { let out = match fut . await { ConvertedImage ( pb , BOR :: Bgra ( bgra ) ) => ConvertedImage ( pb , bgra . 0 . res . into ( ) ) , Image ( BOR :: Bgra ( bgra ) ) => Image ( bgra . 0 . res . into ( ) ) , x => return x , } ; out } ) ; self . 0 = h . map ( | r | match r { Ok ( r ) => r , Err ( e ) => { let e = format ! ( " " e ) ; error ! ( " " e ) ; Invalid ( e ) } } ) . boxed ( ) }
In theory this can be called twice before scanning completes, but in practice it's not worth
optimizing for.
In theory this can be called twice before scanning completes but in practice it ' s not worth optimizing for .
&mut self
&mut self