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: backend.rs
    path of file: ./repos/feather/feather/old/definitions/generator/src
    
    the code of the file until where you have to start completion: use crate::frontend::{Data, Enum, Property, Value};
use crate::model::Type;
use anyhow::Context;
use heck::CamelCase;
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::fs::File;
use std::io::Write;
use std::process::Command;
use syn::export::ToTokens;

/// Given the `Data`, generates code.
pub fn generate(target_dir: &str, data: &Data) -> anyhow::Result<()> {
    let _ = std::fs::remove_dir(target_dir);
    std::fs::create_dir_all(target_dir)
        .with_context(|| format!("failed to create directory `{}`", target_dir))?;

    let mut open_files = HashMap::new
    
    fn tokens(&self, typ: &Type) -> TokenStream {
        match self {
            Value::Bool(x) => quote! { #x },
            Value::Slice(x) => {
                let mut stream = TokenStream::new();
                let inner = if let Type::Slice(inner) = typ {
                    inner
                } else {
                    panic!()
                };

                for value in x {
                    stream.extend(value.tokens(inner.as_ref()));
                }

                stream
            }
            Value::U32(x) => quote! { #x },
            Value::F64(x) => quote! { #x },
            Value::String(x) => quote! { #x },
            Value::Custom(name) => {
                let type_name = if let Type::Custom(x) = typ {
                    ident(x.to_camel_case())
                } else {
                    panic!()
                };
                let name = ident(name.to_camel_case());
                quote! { crate::#type_name::#name }
            }
        }
    }