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: mod.rs
    path of file: ./repos/grafbase/engine/crates/engine-v2/src/request/bind
    
    the code of the file until where you have to start completion: mod coercion;
mod variable;

use std::collections::{HashMap, HashSet};

pub use engine_parser::types::OperationType;
use engine_parser::Positioned;
use engine_value::Name;
use itertools::Itertools;
use schema::{Definition, FieldWalker, IdRange, Schema};

use crate::{
    request::{
        BoundField, BoundFieldArgument, BoundFieldArgumentId, BoundFieldId, BoundFragment, BoundFragmentId,
        BoundFragmentSpread, BoundFragmentSpreadId, BoundInlineFragment, BoundInlineFragmentId, BoundSelection,
        BoundSelectionSet, BoundSelectionSetId, Location, OpInputValue, OpInputValues, Operation, SelectionSetType,
        TypeCondition, VariableDefinition,
    },
    response::{GraphqlError, ResponseKeys},
};

use self::coercion::{const_value::coerce_graphql_const_value, value::coerce_value};
pub use variable::bind_variables;

use super::parse::ParsedOperation;

#[derive(thiserror::Error, Debug)]
pub enum BindError {
    #[error("Unknown type named '{name}'")]
    UnknownType { name: String, location: Location },
    #[error("{container} does not have a field named '{name}'")]
    UnknownField {
        container: String,
        name: String,
        location: Location,
    },
    #[error("Unknown fragment named '{name}'")]
    UnknownFragment { name: String, location: Location },
    #[error("Field '{name}' does not exists on {ty}, it's a union. Only interfaces and objects have fields, consider using a fragment with a type condition.")]
    UnionHaveNoFields {
        name: String,
        ty: String,
        location: Location,
    },
    #[error("Field '{name}' cannot have a selection set, it's a {ty}. Only interfaces, unions and objects can.")]
    CannotHaveSelectionSet {
        name: String,
        ty: String,
        location: Location,
    },
    #[error("Type conditions cannot be declared on '{name}', only on unions, interfaces or objects.")]
    InvalidTypeConditionTargetType { name: String, location: Location },
    #[error("Type condition on '{name}' cannot be used in a '{parent}' 
    
pub fn bind(schema: &Schema, mut unbound: ParsedOperation) -> BindResult<Operation> {
    let root_object_id = match unbound.definition.ty {
        OperationType::Query => schema.root_operation_types.query,
        OperationType::Mutation => schema
            .root_operation_types
            .mutation
            .ok_or(BindError::NoMutationDefined)?,
        OperationType::Subscription => schema
            .root_operation_types
            .subscription
            .ok_or(BindError::NoSubscriptionDefined)?,
    };

    let mut binder = Binder {
        schema,
        operation_name: ErrorOperationName(unbound.name.clone()),
        response_keys: ResponseKeys::default(),
        fragments: HashMap::default(),
        field_arguments: Vec::new(),
        location_to_field_arguments: HashMap::default(),
        fields: Vec::new(),
        selection_sets: Vec::new(),
        unbound_fragments: unbound.fragments,
        variable_definitions: Vec::new(),
        next_response_position: 0,
        current_fragments_stack: Vec::new(),
        fragment_spreads: Vec::new(),
        inline_fragments: Vec::new(),
        field_to_parent: Vec::new(),
        input_values: OpInputValues::default(),
    };

    // Must be executed before binding selection sets
    binder.variable_definitions = binder.bind_variables(unbound.definition.variable_definitions)?;

    let root_selection_set_id = binder.bind_selection_set(
        SelectionSetType::Object(root_object_id),
        &mut unbound.definition.selection_set,
    )?;

    binder.validate_all_variables_used()?;

    Ok(Operation {
        ty: unbound.definition.ty,
        root_object_id,
        name: unbound.name,
        root_selection_set_id,
        selection_sets: binder.selection_sets,
        fragments: {
            let mut fragment_definitions = binder.fragments.into_values().collect::<Vec<_>>();
            fragment_definitions.sort_unstable_by_key(|(id, _)| *id);
            fragment_definitions.into_iter().map(|(_, def)| def).collect()
        },
        field_arguments: binder.field_arguments,
        response_keys: binder.response_keys,
        fields: binder.fields,
        variable_definitions: binder.variable_definitions,
        cache_control: None,
        fragment_spreads: binder.fragment_spreads,
        inline_fragments: binder.inline_fragments,
        field_to_parent: binder.field_to_parent,
        input_values: binder.input_values,
    })
}