pub async fn resolve_object<'a, T: ObjectType + Send + Sync>(
    ctx: &ContextSelectionSet<'a>,
    root: &'a T,
) -> Result<serde_json::Value> {
    let mut fields = Fields(Vec::new());
    fields.add_set(ctx, root)?;
    let futures = fields.0;

    let res = futures::future::try_join_all(futures).await?;
    let mut map = serde_json::Map::new();
    for (name, value) in res {
        if let serde_json::Value::Object(b) = value {
            if let Some(serde_json::Value::Object(a)) = map.get_mut(&name) {
                a.extend(b);
            } else {
                map.insert(name, b.into());
            }
        } else {
            map.insert(name, value);
        }
    }
    Ok(map.into())
}
/// Resolve an object by executing each of the fields concurrently.
Resolve an object by executing each of the fields concurrently.
Resolve an object by executing each of the fields concurrently .
pub async fn resolve_object<'a, T: ObjectType + Send + Sync>(
    ctx: &ContextSelectionSet<'a>,
    root: &'a T,
) -> Result<serde_json::Value> {
    let mut fields = Fields(Vec::new());
    fields.add_set(ctx, root)?;
    let futures = fields.0;
    let res = futures::future::try_join_all(futures).await?;
    let mut map = serde_json::Map::new();
    for (name, value) in res {
        if let serde_json::Value::Object(b) = value {
            if let Some(serde_json::Value::Object(a)) = map.get_mut(&name) {
                a.extend(b);
            } else {
                map.insert(name, b.into());
            }
        } else {
            map.insert(name, value);
        }
    }
    Ok(map.into())
}
pub async fn resolve_object < ' a , T : ObjectType + Send + Sync > ( ctx : & ContextSelectionSet < ' a > , root : & ' a T , ) -> Result < serde_json :: Value > { let mut fields = Fields ( Vec :: new ( ) ) ; fields . add_set ( ctx , root ) ? ; let futures = fields . 0 ; let res = futures :: future :: try_join_all ( futures ) . await ? ; let mut map = serde_json :: Map :: new ( ) ; for ( name , value ) in res { if let serde_json :: Value :: Object ( b ) = value { if let Some ( serde_json :: Value :: Object ( a ) ) = map . get_mut ( & name ) { a . extend ( b ) ; } else { map . insert ( name , b . into ( ) ) ; } } else { map . insert ( name , value ) ; } } Ok ( map . into ( ) ) }
Resolve an object by executing each of the fields concurrently.
Resolve an object by executing each of the fields concurrently .
ctx
&ContextSelectionSet<'a>
root
&'a T
ctx
&ContextSelectionSet<'a>
root
&'a T