pub fn configure<F>(mut self, f: F) -> io::Result<ServerBuilder>
    where
        F: Fn(&mut ServiceConfig) -> io::Result<()>,
    {
        let mut cfg = ServiceConfig::new(self.threads, self.backlog);

        f(&mut cfg)?;

        if let Some(apply) = cfg.apply {
            let mut srv = ConfiguredService::new(apply);
            for (name, lst) in cfg.services {
                let token = self.token.next();
                srv.stream(token, name.clone(), lst.local_addr()?);
                self.sockets.push((token, name, StdListener::Tcp(lst)));
            }
            self.services.push(Box::new(srv));
        }
        self.threads = cfg.threads;

        Ok(self)
    }
/// Execute external configuration as part of the server building
/// process.
///
/// This function is useful for moving parts of configuration to a
/// different module or even library.
Execute external configuration as part of the server building
process.

This function is useful for moving parts of configuration to a
different module or even library.
Execute external configuration as part of the server building process . This function is useful for moving parts of configuration to a different module or even library .
pub fn configure<F>(mut self, f: F) -> io::Result<ServerBuilder>
    where
        F: Fn(&mut ServiceConfig) -> io::Result<()>,
    {
        let mut cfg = ServiceConfig::new(self.threads, self.backlog);
        f(&mut cfg)?;
        if let Some(apply) = cfg.apply {
            let mut srv = ConfiguredService::new(apply);
            for (name, lst) in cfg.services {
                let token = self.token.next();
                srv.stream(token, name.clone(), lst.local_addr()?);
                self.sockets.push((token, name, StdListener::Tcp(lst)));
            }
            self.services.push(Box::new(srv));
        }
        self.threads = cfg.threads;
        Ok(self)
    }
pub fn configure < F > ( mut self , f : F ) -> io :: Result < ServerBuilder > where F : Fn ( & mut ServiceConfig ) -> io :: Result < ( ) > , { let mut cfg = ServiceConfig :: new ( self . threads , self . backlog ) ; f ( & mut cfg ) ? ; if let Some ( apply ) = cfg . apply { let mut srv = ConfiguredService :: new ( apply ) ; for ( name , lst ) in cfg . services { let token = self . token . next ( ) ; srv . stream ( token , name . clone ( ) , lst . local_addr ( ) ? ) ; self . sockets . push ( ( token , name , StdListener :: Tcp ( lst ) ) ) ; } self . services . push ( Box :: new ( srv ) ) ; } self . threads = cfg . threads ; Ok ( self ) }
Execute external configuration as part of the server building
process.
Execute external configuration as part of the server building process .
mut self
f
F
mut self
f
F