pub fn to_toml(&self) -> toml::Value {
        let mut res = toml::value::Table::new();
        res.insert(
            "repository-dir".into(),
            self.cache_dir.display().to_string().into()
        );
        res.insert(
            "tal-dir".into(),
            self.tal_dir.display().to_string().into()
        );
        res.insert(
            "exceptions".into(),
            toml::Value::Array(
                self.exceptions.iter()
                    .map(|p| p.display().to_string().into())
                    .collect()
            )
        );
        res.insert("strict".into(), self.strict.into());
        res.insert("rsync-command".into(), self.rsync_command.clone().into());
        if let Some(ref args) = self.rsync_args {
            res.insert(
                "rsync-args".into(),
                toml::Value::Array(
                    args.iter().map(|a| a.clone().into()).collect()
                )
            );
        }
        res.insert("rsync-count".into(), (self.rsync_count as i64).into());
        res.insert(
            "rsync-timeout".into(),
            (self.rsync_timeout.as_secs() as i64).into()
        );
        res.insert(
            "validation-threads".into(),
            (self.validation_threads as i64).into()
        );
        res.insert("refresh".into(), (self.refresh.as_secs() as i64).into());
        res.insert("retry".into(), (self.retry.as_secs() as i64).into());
        res.insert("expire".into(), (self.expire.as_secs() as i64).into());
        res.insert("history-size".into(), (self.history_size as i64).into());
        res.insert(
            "listen-tcp".into(),
            toml::Value::Array(
                self.tcp_listen.iter().map(|a| a.to_string().into()).collect()
            )
        );
        res.insert(
            "listen-http".into(),
            toml::Value::Array(
                self.http_listen.iter().map(|a| a.to_string().into()).collect()
            )
        );
        res.insert("log-level".into(), self.log_level.to_string().into());
        match self.log_target {
            #[cfg(unix)]
            LogTarget::Default(facility) => {
                res.insert("log".into(), "default".into());
                res.insert(
                    "syslog-facility".into(),
                    facility_to_string(facility).into()
                );
            }
            #[cfg(unix)]
            LogTarget::Syslog(facility) => {
                res.insert("log".into(), "syslog".into());
                res.insert(
                    "syslog-facility".into(),
                    facility_to_string(facility).into()
                );
            }
            LogTarget::Stderr => {
                res.insert("log".into(), "stderr".into());
            }
            LogTarget::File(ref file) => {
                res.insert("log".into(), "file".into());
                res.insert(
                    "log-file".into(),
                    file.display().to_string().into()
                );
            }
        }
        if let Some(ref file) = self.pid_file {
            res.insert("pid-file".into(), file.display().to_string().into());
        }
        if let Some(ref dir) = self.working_dir {
            res.insert("working-dir".into(), dir.display().to_string().into());
        }
        if let Some(ref dir) = self.chroot {
            res.insert("chroot".into(), dir.display().to_string().into());
        }
        res.into()
    }
/// Returns a TOML representation of the config.
Returns a TOML representation of the config.
Returns a TOML representation of the config .
pub fn to_toml(&self) -> toml::Value {
        let mut res = toml::value::Table::new();
        res.insert(
            "repository-dir".into(),
            self.cache_dir.display().to_string().into()
        );
        res.insert(
            "tal-dir".into(),
            self.tal_dir.display().to_string().into()
        );
        res.insert(
            "exceptions".into(),
            toml::Value::Array(
                self.exceptions.iter()
                    .map(|p| p.display().to_string().into())
                    .collect()
            )
        );
        res.insert("strict".into(), self.strict.into());
        res.insert("rsync-command".into(), self.rsync_command.clone().into());
        if let Some(ref args) = self.rsync_args {
            res.insert(
                "rsync-args".into(),
                toml::Value::Array(
                    args.iter().map(|a| a.clone().into()).collect()
                )
            );
        }
        res.insert("rsync-count".into(), (self.rsync_count as i64).into());
        res.insert(
            "rsync-timeout".into(),
            (self.rsync_timeout.as_secs() as i64).into()
        );
        res.insert(
            "validation-threads".into(),
            (self.validation_threads as i64).into()
        );
        res.insert("refresh".into(), (self.refresh.as_secs() as i64).into());
        res.insert("retry".into(), (self.retry.as_secs() as i64).into());
        res.insert("expire".into(), (self.expire.as_secs() as i64).into());
        res.insert("history-size".into(), (self.history_size as i64).into());
        res.insert(
            "listen-tcp".into(),
            toml::Value::Array(
                self.tcp_listen.iter().map(|a| a.to_string().into()).collect()
            )
        );
        res.insert(
            "listen-http".into(),
            toml::Value::Array(
                self.http_listen.iter().map(|a| a.to_string().into()).collect()
            )
        );
        res.insert("log-level".into(), self.log_level.to_string().into());
        match self.log_target {
            #[cfg(unix)]
            LogTarget::Default(facility) => {
                res.insert("log".into(), "default".into());
                res.insert(
                    "syslog-facility".into(),
                    facility_to_string(facility).into()
                );
            }
            #[cfg(unix)]
            LogTarget::Syslog(facility) => {
                res.insert("log".into(), "syslog".into());
                res.insert(
                    "syslog-facility".into(),
                    facility_to_string(facility).into()
                );
            }
            LogTarget::Stderr => {
                res.insert("log".into(), "stderr".into());
            }
            LogTarget::File(ref file) => {
                res.insert("log".into(), "file".into());
                res.insert(
                    "log-file".into(),
                    file.display().to_string().into()
                );
            }
        }
        if let Some(ref file) = self.pid_file {
            res.insert("pid-file".into(), file.display().to_string().into());
        }
        if let Some(ref dir) = self.working_dir {
            res.insert("working-dir".into(), dir.display().to_string().into());
        }
        if let Some(ref dir) = self.chroot {
            res.insert("chroot".into(), dir.display().to_string().into());
        }
        res.into()
    }
pub fn to_toml ( & self ) -> toml :: Value { let mut res = toml :: value :: Table :: new ( ) ; res . insert ( " " . into ( ) , self . cache_dir . display ( ) . to_string ( ) . into ( ) ) ; res . insert ( " " . into ( ) , self . tal_dir . display ( ) . to_string ( ) . into ( ) ) ; res . insert ( " " . into ( ) , toml :: Value :: Array ( self . exceptions . iter ( ) . map ( | p | p . display ( ) . to_string ( ) . into ( ) ) . collect ( ) ) ) ; res . insert ( " " . into ( ) , self . strict . into ( ) ) ; res . insert ( " " . into ( ) , self . rsync_command . clone ( ) . into ( ) ) ; if let Some ( ref args ) = self . rsync_args { res . insert ( " " . into ( ) , toml :: Value :: Array ( args . iter ( ) . map ( | a | a . clone ( ) . into ( ) ) . collect ( ) ) ) ; } res . insert ( " " . into ( ) , ( self . rsync_count as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , ( self . rsync_timeout . as_secs ( ) as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , ( self . validation_threads as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , ( self . refresh . as_secs ( ) as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , ( self . retry . as_secs ( ) as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , ( self . expire . as_secs ( ) as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , ( self . history_size as i64 ) . into ( ) ) ; res . insert ( " " . into ( ) , toml :: Value :: Array ( self . tcp_listen . iter ( ) . map ( | a | a . to_string ( ) . into ( ) ) . collect ( ) ) ) ; res . insert ( " " . into ( ) , toml :: Value :: Array ( self . http_listen . iter ( ) . map ( | a | a . to_string ( ) . into ( ) ) . collect ( ) ) ) ; res . insert ( " " . into ( ) , self . log_level . to_string ( ) . into ( ) ) ; match self . log_target { # [ cfg ( unix ) ] LogTarget :: Default ( facility ) => { res . insert ( " " . into ( ) , " " . into ( ) ) ; res . insert ( " " . into ( ) , facility_to_string ( facility ) . into ( ) ) ; } # [ cfg ( unix ) ] LogTarget :: Syslog ( facility ) => { res . insert ( " " . into ( ) , " " . into ( ) ) ; res . insert ( " " . into ( ) , facility_to_string ( facility ) . into ( ) ) ; } LogTarget :: Stderr => { res . insert ( " " . into ( ) , " " . into ( ) ) ; } LogTarget :: File ( ref file ) => { res . insert ( " " . into ( ) , " " . into ( ) ) ; res . insert ( " " . into ( ) , file . display ( ) . to_string ( ) . into ( ) ) ; } } if let Some ( ref file ) = self . pid_file { res . insert ( " " . into ( ) , file . display ( ) . to_string ( ) . into ( ) ) ; } if let Some ( ref dir ) = self . working_dir { res . insert ( " " . into ( ) , dir . display ( ) . to_string ( ) . into ( ) ) ; } if let Some ( ref dir ) = self . chroot { res . insert ( " " . into ( ) , dir . display ( ) . to_string ( ) . into ( ) ) ; } res . into ( ) }
Returns a TOML representation of the config.
Returns a TOML representation of the config .
&self
&self