pub fn flatten(program: &mut Program, is_for_codegen: bool) -> DiagnosticsResult<()> {
    let transform = FlattenTransform::new(program, is_for_codegen);
    let errors = Arc::new(Mutex::new(Vec::new()));

    program.par_operations_mut().for_each(|operation| {
        if let Err(err) = transform.transform_operation(operation) {
            errors.lock().extend(err.into_iter());
        }
    });
    program.par_fragments_mut().for_each(|fragment| {
        if let Err(err) = transform.transform_fragment(fragment) {
            errors.lock().extend(err.into_iter());
        }
    });
    let is_errors_empty = { errors.lock().is_empty() };
    if is_errors_empty {
        Ok(())
    } else {
        Err(Arc::try_unwrap(errors).unwrap().into_inner())
    }
}
/// Transform that flattens inline fragments, fragment spreads, merges linked fields selections.
///
/// Inline fragments are inlined (replaced with their selections) when:
/// - The fragment type matches the type of its parent, and it `is_for_codegen`,
///   or the inline fragment doesn't have directives .
///
/// with the exception that it never flattens the inline fragment with relay
/// directives (@defer, @__clientExtensions).
Transform that flattens inline fragments, fragment spreads, merges linked fields selections.
Inline fragments are inlined (replaced with their selections) when:
The fragment type matches the type of its parent, and it `is_for_codegen`,
or the inline fragment doesn't have directives .

with the exception that it never flattens the inline fragment with relay
directives (@defer, @__clientExtensions).
Transform that flattens inline fragments fragment spreads merges linked fields selections . Inline fragments are inlined ( replaced with their selections ) when : The fragment type matches the type of its parent and it ` is_for_codegen ` or the inline fragment doesn ' t have directives . with the exception that it never flattens the inline fragment with relay directives ( @defer @__clientExtensions ) .
pub fn flatten(program: &mut Program, is_for_codegen: bool) -> DiagnosticsResult<()> {
    let transform = FlattenTransform::new(program, is_for_codegen);
    let errors = Arc::new(Mutex::new(Vec::new()));
    program.par_operations_mut().for_each(|operation| {
        if let Err(err) = transform.transform_operation(operation) {
            errors.lock().extend(err.into_iter());
        }
    });
    program.par_fragments_mut().for_each(|fragment| {
        if let Err(err) = transform.transform_fragment(fragment) {
            errors.lock().extend(err.into_iter());
        }
    });
    let is_errors_empty = { errors.lock().is_empty() };
    if is_errors_empty {
        Ok(())
    } else {
        Err(Arc::try_unwrap(errors).unwrap().into_inner())
    }
}
pub fn flatten ( program : & mut Program , is_for_codegen : bool ) -> DiagnosticsResult < ( ) > { let transform = FlattenTransform :: new ( program , is_for_codegen ) ; let errors = Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ; program . par_operations_mut ( ) . for_each ( | operation | { if let Err ( err ) = transform . transform_operation ( operation ) { errors . lock ( ) . extend ( err . into_iter ( ) ) ; } } ) ; program . par_fragments_mut ( ) . for_each ( | fragment | { if let Err ( err ) = transform . transform_fragment ( fragment ) { errors . lock ( ) . extend ( err . into_iter ( ) ) ; } } ) ; let is_errors_empty = { errors . lock ( ) . is_empty ( ) } ; if is_errors_empty { Ok ( ( ) ) } else { Err ( Arc :: try_unwrap ( errors ) . unwrap ( ) . into_inner ( ) ) } }
Transform that flattens inline fragments, fragment spreads, merges linked fields selections.
Transform that flattens inline fragments fragment spreads merges linked fields selections .
program
&mut Program
is_for_codegen
bool
program
&mut Program
is_for_codegen
bool