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: cosmic_text.rs
    path of file: ./repos/taffy/examples
    
    the code of the file until where you have to start completion: mod common {
    pub mod image;
}
use common::image::{image_measure_function, ImageContext};
use cosmic_text::{Attrs, Buffer, FontSystem, Metrics, Shaping};
use taffy::prelude::*;

pub const LOREM_IPSUM : &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

struct CosmicTextContext {
    buffer: cosmic_text::Buffer,
}

impl CosmicTextContext {
    fn new(metrics: Metrics, text: &str, attrs: Attrs, font_system: &mut FontSystem) -> Self {
        let mut buffer = Buffer::new_empty(metrics);
        buffer.set_size(font_system, f32::INFINITY, f32::INFINITY);
        buffer.set_text(font_system, text, attrs, Shaping::Advanced);
        Self { buffer }
    }

    fn measure(
        &mut self,
        known_dimensions: taffy::Si
    
fn main() -> Result<(), taffy::TaffyError> {
    let metrics = Metrics { font_size: 14.0, line_height: 16.0 };
    let mut font_system = FontSystem::new();
    let mut taffy: TaffyTree<NodeContext> = TaffyTree::new();

    let text_node = taffy.new_leaf_with_context(
        Style::default(),
        NodeContext::text(metrics, LOREM_IPSUM, Attrs::new(), &mut font_system),
    )?;

    let image_node = taffy.new_leaf_with_context(Style::default(), NodeContext::image(400.0, 300.0))?;

    let root = taffy.new_with_children(
        Style {
            display: Display::Flex,
            flex_direction: FlexDirection::Column,
            size: Size { width: length(200.0), height: auto() },
            ..Default::default()
        },
        &[text_node, image_node],
    )?;

    // Compute layout and print result
    taffy.compute_layout_with_measure(
        root,
        Size::MAX_CONTENT,
        // Note: this closure is a FnMut closure and can be used to borrow external context for the duration of layout
        // For example, you may wish to borrow a global font registry and pass it into your text measuring function
        |known_dimensions, available_space, _node_id, node_context| {
            measure_function(known_dimensions, available_space, node_context, &mut font_system)
        },
    )?;
    taffy.print_tree(root);

    Ok(())
}