fn should_show_elements<'a>(
                                format_elements: &[FormatElement],
                                variables: &'a VariableMapType<'a>,
                            ) -> bool {
                                format_elements.get_variables().iter().any(|var| {
                                    variables
                                        .get(var.as_ref())
                                        .map(|map_result| {
                                            let map_result = map_result.as_ref();
                                            map_result
                                                .and_then(|result| result.as_ref().ok())
                                                .map(|result| match result {
                                                    // If the variable is a meta variable, also
                                                    // check the format string inside it.
                                                    VariableValue::Meta(meta_elements) => {
                                                        let meta_variables =
                                                            clone_without_meta(variables);
                                                        should_show_elements(
                                                            &meta_elements,
                                                            &meta_variables,
                                                        )
                                                    }
                                                    _ => true,
                                                })
                                                // The variable is None or Err, or a meta variable
                                                // that shouldn't show
                                                .unwrap_or(false)
                                        })
                                        // Can't find the variable in format string
                                        .unwrap_or(false)
                                })
                            }
// Show the conditional format string if all the variables inside are not
// none.
Show the conditional format string if all the variables inside are not
none.
Show the conditional format string if all the variables inside are not none .
fn should_show_elements<'a>(
                                format_elements: &[FormatElement],
                                variables: &'a VariableMapType<'a>,
                            ) -> bool {
                                format_elements.get_variables().iter().any(|var| {
                                    variables
                                        .get(var.as_ref())
                                        .map(|map_result| {
                                            let map_result = map_result.as_ref();
                                            map_result
                                                .and_then(|result| result.as_ref().ok())
                                                .map(|result| match result {
                                                    // If the variable is a meta variable, also
                                                    // check the format string inside it.
                                                    VariableValue::Meta(meta_elements) => {
                                                        let meta_variables =
                                                            clone_without_meta(variables);
                                                        should_show_elements(
                                                            &meta_elements,
                                                            &meta_variables,
                                                        )
                                                    }
                                                    _ => true,
                                                })
                                                // The variable is None or Err, or a meta variable
                                                // that shouldn't show
                                                .unwrap_or(false)
                                        })
                                        // Can't find the variable in format string
                                        .unwrap_or(false)
                                })
                            }
fn should_show_elements < ' a > ( format_elements : & [ FormatElement ] , variables : & ' a VariableMapType < ' a > , ) -> bool { format_elements . get_variables ( ) . iter ( ) . any ( | var | { variables . get ( var . as_ref ( ) ) . map ( | map_result | { let map_result = map_result . as_ref ( ) ; map_result . and_then ( | result | result . as_ref ( ) . ok ( ) ) . map ( | result | match result { // If the variable is a meta variable, also // check the format string inside it. VariableValue :: Meta ( meta_elements ) => { let meta_variables = clone_without_meta ( variables ) ; should_show_elements ( & meta_elements , & meta_variables , ) } _ => true , } ) // The variable is None or Err, or a meta variable // that shouldn't show . unwrap_or ( false ) } ) // Can't find the variable in format string . unwrap_or ( false ) } ) }
Show the conditional format string if all the variables inside are not
none.
Show the conditional format string if all the variables inside are not none .
format_elements
&[FormatElement]
variables
&'a VariableMapType<'a>