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: crate_context.rs
    path of file: ./repos/rules_rust/crate_universe/src/context
    
    the code of the file until where you have to start completion: //! Crate specific information embedded into [crate::context::Context] objects.

use std::collections::{BTreeMap, BTreeSet};

use cargo_metadata::{Node, Package, PackageId};
use serde::{Deserialize, Serialize};

use crate::config::{AliasRule, CrateId, GenBinaries};
use crate::metadata::{CrateAnnotation, Dependency, PairedExtras, SourceAnnotation};
use crate::select::Select;
use crate::utils::sanitize_module_name;
use crate::utils::starlark::{Glob, Label};

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct CrateDependency {
    /// The [CrateId] of the dependency
    pub id: CrateId,

    /// The target name of the dependency. Note this may differ from the
    /// dependency's package name in cases such as build scripts.
    pub target: String,

    /// Some dependencies are assigned aliases. This is tracked here
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub alias: Option<String>,
}

#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Clone)]
#[serde(default)]
pub(crate) struct TargetAttributes {
    /// The module name of the crate (notably, not the package name).
    //
    // This must be the first field of `TargetAttributes` to make it the
    // lexicographically first thing the derived `Ord` implementation will sort
    // by. The `Ord`
    
    fn with_overrides(mut self, extras: &BTreeMap<CrateId, PairedExtras>) -> Self {
        let id = CrateId::new(self.name.clone(), self.version.clone());

        // Insert all overrides/extras
        if let Some(paired_override) = extras.get(&id) {
            let crate_extra = &paired_override.crate_extra;

            // Deps
            if let Some(extra) = &crate_extra.deps {
                self.common_attrs.extra_deps =
                    Select::merge(self.common_attrs.extra_deps, extra.clone());
            }

            // Proc macro deps
            if let Some(extra) = &crate_extra.proc_macro_deps {
                self.common_attrs.extra_proc_macro_deps =
                    Select::merge(self.common_attrs.extra_proc_macro_deps, extra.clone());
            }

            // Compile data
            if let Some(extra) = &crate_extra.compile_data {
                self.common_attrs.compile_data =
                    Select::merge(self.common_attrs.compile_data, extra.clone());
            }

            // Compile data glob
            if let Some(extra) = &crate_extra.compile_data_glob {
                self.common_attrs.compile_data_glob.extend(extra.clone());
            }

            // Crate features
            if let Some(extra) = &crate_extra.crate_features {
                self.common_attrs.crate_features =
                    Select::merge(self.common_attrs.crate_features, extra.clone());
            }

            // Data
            if let Some(extra) = &crate_extra.data {
                self.common_attrs.data = Select::merge(self.common_attrs.data, extra.clone());
            }

            // Data glob
            if let Some(extra) = &crate_extra.data_glob {
                self.common_attrs.data_glob.extend(extra.clone());
            }

            // Disable pipelining
            if crate_extra.disable_pipelining {
                self.disable_pipelining = true;
            }

            // Rustc flags
            if let Some(extra) = &crate_extra.rustc_flags {
                self.common_attrs.rustc_flags =
                    Select::merge(self.common_attrs.rustc_flags, extra.clone());
            }

            // Rustc env
            if let Some(extra) = &crate_extra.rustc_env {
                self.common_attrs.rustc_env =
                    Select::merge(self.common_attrs.rustc_env, extra.clone());
            }

            // Rustc env files
            if let Some(extra) = &crate_extra.rustc_env_files {
                self.common_attrs.rustc_env_files =
                    Select::merge(self.common_attrs.rustc_env_files, extra.clone());
            }

            // Build script Attributes
            if let Some(attrs) = &mut self.build_script_attrs {
                // Deps
                if let Some(extra) = &crate_extra.build_script_deps {
                    attrs.extra_deps = Select::merge(attrs.extra_deps.clone(), extra.clone());
                }

                // Proc macro deps
                if let Some(extra) = &crate_extra.build_script_proc_macro_deps {
                    attrs.extra_proc_macro_deps =
                        Select::merge(attrs.extra_proc_macro_deps.clone(), extra.clone());
                }

                // Data
                if let Some(extra) = &crate_extra.build_script_data {
                    attrs.data = Select::merge(attrs.data.clone(), extra.clone());
                }

                // Tools
                if let Some(extra) = &crate_extra.build_script_tools {
                    attrs.tools = Select::merge(attrs.tools.clone(), extra.clone());
                }

                // Toolchains
                if let Some(extra) = &crate_extra.build_script_toolchains {
                    attrs.toolchains.extend(extra.iter().cloned());
                }

                // Data glob
                if let Some(extra) = &crate_extra.build_script_data_glob {
                    attrs.data_glob.extend(extra.clone());
                }

                // Rustc env
                if let Some(extra) = &crate_extra.build_script_rustc_env {
                    attrs.rustc_env = Select::merge(attrs.rustc_env.clone(), extra.clone());
                }

                // Build script env
                if let Some(extra) = &crate_extra.build_script_env {
                    attrs.build_script_env =
                        Select::merge(attrs.build_script_env.clone(), extra.clone());
                }

                if let Some(rundir) = &crate_extra.build_script_rundir {
                    attrs.rundir = Select::merge(attrs.rundir.clone(), rundir.clone());
                }
            }

            // Extra build contents
            self.additive_build_file_content = crate_extra
                .additive_build_file_content
                .as_ref()
                .map(|content| {
                    // For prettier rendering, dedent the build contents
                    textwrap::dedent(content)
                });

            // Extra aliased targets
            if let Some(extra) = &crate_extra.extra_aliased_targets {
                self.extra_aliased_targets.append(&mut extra.clone());
            }

            // Transition alias
            if let Some(alias_rule) = &crate_extra.alias_rule {
                self.alias_rule.get_or_insert(alias_rule.clone());
            }

            // Git shallow_since
            if let Some(SourceAnnotation::Git { shallow_since, .. }) = &mut self.repository {
                *shallow_since = crate_extra.shallow_since.clone()
            }

            // Patch attributes
            if let Some(repository) = &mut self.repository {
                match repository {
                    SourceAnnotation::Git {
                        patch_args,
                        patch_tool,
                        patches,
                        ..
                    } => {
                        *patch_args = crate_extra.patch_args.clone();
                        *patch_tool = crate_extra.patch_tool.clone();
                        *patches = crate_extra.patches.clone();
                    }
                    SourceAnnotation::Http {
                        patch_args,
                        patch_tool,
                        patches,
                        ..
                    } => {
                        *patch_args = crate_extra.patch_args.clone();
                        *patch_tool = crate_extra.patch_tool.clone();
                        *patches = crate_extra.patches.clone();
                    }
                }
            }
        }

        self
    }