You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: element.rs
    path of file: ./repos/tools/crates/rome_js_formatter/src/jsx/tag
    
    the code of the file until where you have to start completion: use crate::prelude::*;

use crate::jsx::lists::child_list::{FormatChildrenResult, FormatJsxChildList, JsxChildListLayout};
use crate::utils::jsx::{is_jsx_suppressed, is_meaningful_jsx_text};
use rome_formatter::{format_args, write, CstFormatContext, FormatResult, FormatRuleWithOptions};
use rome_js_syntax::{
    AnyJsExpression, AnyJsxChild, JsxChildList, JsxElement, JsxExpressionChild, JsxFragment,
};
use rome_rowan::{declare_node_union, SyntaxResult};

#[derive(Debug, Clone, Default)]
pub struct FormatJsxElement;

impl FormatNodeRule<JsxElement> for FormatJsxElement {
    fn fmt_fields(&self, node: &JsxElement, f: &mut JsFormatter) -> FormatResult<()> {
        AnyJsxTagWithChildren::from(node.clone()).fmt(f)
    }

    fn is_suppressed(&self, node: &JsxElement, f: &JsFormatter) -> bool {
        is_jsx_suppressed(&node.clone().into(), f.comments())
    }

    fn fmt_leading_comments(&self, node: &JsxElement, f: &mut JsFormatter) -> FormatResult<()> {
        debug_assert!(
            !f.comments().has_leading_comments(node.syntax()),
            "JsxElement can not have comments."
        );
        Ok(())
    }

    fn fmt_dangling_comments(&self, node: &JsxElement, f: &mut JsFormatter) -> FormatResult<()> {
        debug_assert!(
            !f.comments().has_dangling_comments(node.syntax()),
            "JsxElement can not have comments."
        );
        Ok(())
    }

    fn fmt_trailing_comments(&self, node: &JsxElement, f: &mut JsFormatter) -> FormatResult<()> {
        debug_assert!(
            !f.comments().has_trailing_comments(node.syntax()),
            "JsxElement can not have comments."
        );
        Ok(())
    }
}

declare_node_union! {
    pub(super) AnyJsxTagWithChildren = JsxElement | JsxFragment
}

impl Format<JsFormatContext> for AnyJsxTagWithChildren {
    fn fmt(&self, f: &mut Formatter<
    
    fn fmt(&self, f: &mut Formatter<JsFormatContext>) -> FormatResult<()> {
        let format_opening = format_with(|f| self.fmt_opening(f));
        let format_closing = format_with(|f| self.fmt_closing(f));

        let layout = self.layout(f)?;

        match layout {
            ElementLayout::NoChildren => {
                write!(f, [format_opening, format_closing])
            }

            ElementLayout::Template(expression) => {
                write!(f, [format_opening, expression.format(), format_closing])
            }

            ElementLayout::Default => {
                let mut format_opening = format_opening.memoized();
                let opening_breaks = format_opening.inspect(f)?.will_break();

                let multiple_attributes = match self {
                    AnyJsxTagWithChildren::JsxElement(element) => {
                        element.opening_element()?.attributes().len() > 1
                    }
                    AnyJsxTagWithChildren::JsxFragment(_) => false,
                };

                let list_layout = if multiple_attributes || opening_breaks {
                    JsxChildListLayout::Multiline
                } else {
                    JsxChildListLayout::BestFitting
                };

                let children = self.children();
                let format_children = FormatJsxChildList::default()
                    .with_options(list_layout)
                    .fmt_children(&children, f)?;

                match format_children {
                    FormatChildrenResult::ForceMultiline(multiline) => {
                        write!(f, [format_opening, multiline, format_closing])
                    }
                    FormatChildrenResult::BestFitting {
                        flat_children,
                        expanded_children,
                    } => {
                        let format_closing = format_closing.memoized();
                        write!(
                            f,
                            [best_fitting![
                                format_args![format_opening, flat_children, format_closing],
                                format_args![format_opening, expanded_children, format_closing]
                            ]]
                        )
                    }
                }
            }
        }
    }