fn next_file_name_of_time(&self, time: u64) -> Result<String> {
        let date_str = utils::format_date(time);
        let file_pattern = self.base_filename.to_str().unwrap().to_owned() + "." + &date_str;
        let list = list_metric_files_conditional(
            &self.base_dir,
            &PathBuf::from(&file_pattern),
            |filename: &str, p: &str| -> bool { filename.contains(p) },
        )?;
        if list.len() == 0 {
            return Ok(self.base_dir.to_str().unwrap().to_owned() + &file_pattern);
        }
        // Find files with the same prefix pattern, have to add the order to separate files.
        let last = &list[list.len() - 1];
        let mut n = 0;
        let items = last.to_str().unwrap().split(".").collect::<Vec<&str>>();
        if items.len() > 0 {
            n = str::parse::<u32>(items[items.len() - 1]).unwrap_or(0);
        }
        return Ok(format!(
            "{}{}.{}",
            self.base_dir.to_str().unwrap().to_owned(),
            file_pattern,
            n + 1
        ));
    }
/// Compute the next file name of the given time. Find the lastest file with the same prefix pattern and add increase the order.
/// And never use `fmt::Debug` to print the file name (either `String/&str` or `PathBuf/&Path`), since it will contain `\"`.
Compute the next file name of the given time. Find the lastest file with the same prefix pattern and add increase the order.
Compute the next file name of the given time . Find the lastest file with the same prefix pattern and add increase the order .
fn next_file_name_of_time(&self, time: u64) -> Result<String> {
        let date_str = utils::format_date(time);
        let file_pattern = self.base_filename.to_str().unwrap().to_owned() + "." + &date_str;
        let list = list_metric_files_conditional(
            &self.base_dir,
            &PathBuf::from(&file_pattern),
            |filename: &str, p: &str| -> bool { filename.contains(p) },
        )?;
        if list.len() == 0 {
            return Ok(self.base_dir.to_str().unwrap().to_owned() + &file_pattern);
        }
        // Find files with the same prefix pattern, have to add the order to separate files.
        let last = &list[list.len() - 1];
        let mut n = 0;
        let items = last.to_str().unwrap().split(".").collect::<Vec<&str>>();
        if items.len() > 0 {
            n = str::parse::<u32>(items[items.len() - 1]).unwrap_or(0);
        }
        return Ok(format!(
            "{}{}.{}",
            self.base_dir.to_str().unwrap().to_owned(),
            file_pattern,
            n + 1
        ));
    }
fn next_file_name_of_time ( & self , time : u64 ) -> Result < String > { let date_str = utils :: format_date ( time ) ; let file_pattern = self . base_filename . to_str ( ) . unwrap ( ) . to_owned ( ) + " " + & date_str ; let list = list_metric_files_conditional ( & self . base_dir , & PathBuf :: from ( & file_pattern ) , | filename : & str , p : & str | -> bool { filename . contains ( p ) } , ) ? ; if list . len ( ) == 0 { return Ok ( self . base_dir . to_str ( ) . unwrap ( ) . to_owned ( ) + & file_pattern ) ; } // Find files with the same prefix pattern, have to add the order to separate files. let last = & list [ list . len ( ) - 1 ] ; let mut n = 0 ; let items = last . to_str ( ) . unwrap ( ) . split ( " " ) . collect :: < Vec < & str > > ( ) ; if items . len ( ) > 0 { n = str :: parse :: < u32 > ( items [ items . len ( ) - 1 ] ) . unwrap_or ( 0 ) ; } return Ok ( format ! ( " " self base_dir to_str ( ) unwrap ( ) to_owned ( ) file_pattern n 1 ) ) ; }
Compute the next file name of the given time.
Compute the next file name of the given time .
&self
time
u64
&self
time
u64