fn make_log_index_max_interval_bytes(file_cfg: &Option<SpuConfigFile>) -> Result<u32, IoError> {
        let mut log_index_max_interval_bytes = None;

        // 1) environment variable (optional field, ignore errors)
        if let Ok(log_index_max_interval_bytes_str) = env::var(FLV_LOG_INDEX_MAX_INTERVAL_BYTES) {
            let index_max_interval_bytes: u32 =
                log_index_max_interval_bytes_str.parse().map_err(|err| {
                    IoError::new(
                        ErrorKind::InvalidInput,
                        format!("log index-max-interval-bytes: {}", err),
                    )
                })?;
            log_index_max_interval_bytes = Some(index_max_interval_bytes);
        }

        // 2) config file
        if log_index_max_interval_bytes.is_none() && file_cfg.is_some() {
            log_index_max_interval_bytes =
                file_cfg.as_ref().unwrap().log_index_max_interval_bytes();
        }

        // 3) unwrap or use default
        Ok(log_index_max_interval_bytes.unwrap_or(SPU_LOG_INDEX_MAX_INTERVAL_BYTES))
    }
/// Generate log index_max_interval_bytes by combining all config elements. Returns error on failure.
Generate log index_max_interval_bytes by combining all config elements. Returns error on failure.
Generate log index_max_interval_bytes by combining all config elements . Returns error on failure .
fn make_log_index_max_interval_bytes(file_cfg: &Option<SpuConfigFile>) -> Result<u32, IoError> {
        let mut log_index_max_interval_bytes = None;
        // 1) environment variable (optional field, ignore errors)
        if let Ok(log_index_max_interval_bytes_str) = env::var(FLV_LOG_INDEX_MAX_INTERVAL_BYTES) {
            let index_max_interval_bytes: u32 =
                log_index_max_interval_bytes_str.parse().map_err(|err| {
                    IoError::new(
                        ErrorKind::InvalidInput,
                        format!("log index-max-interval-bytes: {}", err),
                    )
                })?;
            log_index_max_interval_bytes = Some(index_max_interval_bytes);
        }
        // 2) config file
        if log_index_max_interval_bytes.is_none() && file_cfg.is_some() {
            log_index_max_interval_bytes =
                file_cfg.as_ref().unwrap().log_index_max_interval_bytes();
        }
        // 3) unwrap or use default
        Ok(log_index_max_interval_bytes.unwrap_or(SPU_LOG_INDEX_MAX_INTERVAL_BYTES))
    }
fn make_log_index_max_interval_bytes ( file_cfg : & Option < SpuConfigFile > ) -> Result < u32 , IoError > { let mut log_index_max_interval_bytes = None ; // 1) environment variable (optional field, ignore errors) if let Ok ( log_index_max_interval_bytes_str ) = env :: var ( FLV_LOG_INDEX_MAX_INTERVAL_BYTES ) { let index_max_interval_bytes : u32 = log_index_max_interval_bytes_str . parse ( ) . map_err ( | err | { IoError :: new ( ErrorKind :: InvalidInput , format ! ( " " err ) , ) } ) ? ; log_index_max_interval_bytes = Some ( index_max_interval_bytes ) ; } // 2) config file if log_index_max_interval_bytes . is_none ( ) && file_cfg . is_some ( ) { log_index_max_interval_bytes = file_cfg . as_ref ( ) . unwrap ( ) . log_index_max_interval_bytes ( ) ; } // 3) unwrap or use default Ok ( log_index_max_interval_bytes . unwrap_or ( SPU_LOG_INDEX_MAX_INTERVAL_BYTES ) ) }
Generate log index_max_interval_bytes by combining all config elements.
Generate log index_max_interval_bytes by combining all config elements .
file_cfg
&Option<SpuConfigFile>
file_cfg
&Option<SpuConfigFile>