pub fn serve(mut self) -> Result<(), Error> {
        // Loop until we're done.
        while !self.should_quit.get() {
            self.queue
                .dispatch(&mut (), |_, _, _| {})
                .map_err(Error::WaylandCommunication)?;

            // Check if all sources have been destroyed.
            let all_destroyed = self.sources.iter().all(|x| !x.is_alive());
            if all_destroyed {
                self.should_quit.set(true);
            }
        }

        // Clean up the temp file and directory.
        //
        // We want to try cleaning up all files and folders, so if any errors occur in process,
        // collect them into a vector without interruption, and then return the first one.
        let mut results = Vec::new();
        let mut dropped = HashSet::new();
        for data_path in self.data_paths.values() {
            let buf = data_path.as_ptr();
            // data_paths can contain duplicate items, we want to free each only once.
            if dropped.contains(&buf) {
                continue;
            };
            dropped.insert(buf);

            let mut data_path = data_path.borrow_mut();
            match remove_file(&*data_path).map_err(Error::TempFileRemove) {
                Ok(()) => {
                    data_path.pop();
                    results.push(remove_dir(&*data_path).map_err(Error::TempDirRemove));
                }
                result @ Err(_) => results.push(result),
            }
        }

        // Return the error, if any.
        let result: Result<_, _> = results.into_iter().collect();
        result?;

        // Check if an error occurred during data transfer.
        if let Some(err) = self.error.borrow_mut().take() {
            return Err(Error::Paste(err));
        }

        Ok(())
    }
/// Starts serving copy requests.
///
/// This function **blocks** until all requests are served or the clipboard is taken over by
/// some other application.
Starts serving copy requests.
This function **blocks** until all requests are served or the clipboard is taken over by
some other application.
Starts serving copy requests . This function ** blocks ** until all requests are served or the clipboard is taken over by some other application .
pub fn serve(mut self) -> Result<(), Error> {
        // Loop until we're done.
        while !self.should_quit.get() {
            self.queue
                .dispatch(&mut (), |_, _, _| {})
                .map_err(Error::WaylandCommunication)?;
            // Check if all sources have been destroyed.
            let all_destroyed = self.sources.iter().all(|x| !x.is_alive());
            if all_destroyed {
                self.should_quit.set(true);
            }
        }
        // Clean up the temp file and directory.
        //
        // We want to try cleaning up all files and folders, so if any errors occur in process,
        // collect them into a vector without interruption, and then return the first one.
        let mut results = Vec::new();
        let mut dropped = HashSet::new();
        for data_path in self.data_paths.values() {
            let buf = data_path.as_ptr();
            // data_paths can contain duplicate items, we want to free each only once.
            if dropped.contains(&buf) {
                continue;
            };
            dropped.insert(buf);
            let mut data_path = data_path.borrow_mut();
            match remove_file(&*data_path).map_err(Error::TempFileRemove) {
                Ok(()) => {
                    data_path.pop();
                    results.push(remove_dir(&*data_path).map_err(Error::TempDirRemove));
                }
                result @ Err(_) => results.push(result),
            }
        }
        // Return the error, if any.
        let result: Result<_, _> = results.into_iter().collect();
        result?;
        // Check if an error occurred during data transfer.
        if let Some(err) = self.error.borrow_mut().take() {
            return Err(Error::Paste(err));
        }
        Ok(())
    }
pub fn serve ( mut self ) -> Result < ( ) , Error > { // Loop until we're done. while ! self . should_quit . get ( ) { self . queue . dispatch ( & mut ( ) , | _ , _ , _ | { } ) . map_err ( Error :: WaylandCommunication ) ? ; // Check if all sources have been destroyed. let all_destroyed = self . sources . iter ( ) . all ( | x | ! x . is_alive ( ) ) ; if all_destroyed { self . should_quit . set ( true ) ; } } // Clean up the temp file and directory. // // We want to try cleaning up all files and folders, so if any errors occur in process, // collect them into a vector without interruption, and then return the first one. let mut results = Vec :: new ( ) ; let mut dropped = HashSet :: new ( ) ; for data_path in self . data_paths . values ( ) { let buf = data_path . as_ptr ( ) ; // data_paths can contain duplicate items, we want to free each only once. if dropped . contains ( & buf ) { continue ; } ; dropped . insert ( buf ) ; let mut data_path = data_path . borrow_mut ( ) ; match remove_file ( & * data_path ) . map_err ( Error :: TempFileRemove ) { Ok ( ( ) ) => { data_path . pop ( ) ; results . push ( remove_dir ( & * data_path ) . map_err ( Error :: TempDirRemove ) ) ; } result @ Err ( _ ) => results . push ( result ) , } } // Return the error, if any. let result : Result < _ , _ > = results . into_iter ( ) . collect ( ) ; result ? ; // Check if an error occurred during data transfer. if let Some ( err ) = self . error . borrow_mut ( ) . take ( ) { return Err ( Error :: Paste ( err ) ) ; } Ok ( ( ) ) }
Starts serving copy requests.
Starts serving copy requests .
mut self
mut self