[][src]Function cynic::selection_set::map12

pub fn map12<'a, F, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, NewDecodesTo, TypeLock>(
    func: F,
    _1: SelectionSet<'a, _1, TypeLock>,
    _2: SelectionSet<'a, _2, TypeLock>,
    _3: SelectionSet<'a, _3, TypeLock>,
    _4: SelectionSet<'a, _4, TypeLock>,
    _5: SelectionSet<'a, _5, TypeLock>,
    _6: SelectionSet<'a, _6, TypeLock>,
    _7: SelectionSet<'a, _7, TypeLock>,
    _8: SelectionSet<'a, _8, TypeLock>,
    _9: SelectionSet<'a, _9, TypeLock>,
    _10: SelectionSet<'a, _10, TypeLock>,
    _11: SelectionSet<'a, _11, TypeLock>,
    _12: SelectionSet<'a, _12, TypeLock>
) -> SelectionSet<'a, NewDecodesTo, TypeLock> where
    F: Fn(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) -> NewDecodesTo + 'a + Send + Sync,
    _1: 'a,
    _2: 'a,
    _3: 'a,
    _4: 'a,
    _5: 'a,
    _6: 'a,
    _7: 'a,
    _8: 'a,
    _9: 'a,
    _10: 'a,
    _11: 'a,
    _12: 'a,
    NewDecodesTo: 'a, 

Applies a function to the result of some SelectionSets.

This can be used to create structs from the SelectionSets of their fields. For example, to create a user with three fields we would use the map3 function:

struct User {
    id: i32,
    name: String,
    email: String,
}

impl User {
    fn new(id: i32, name: String, email: String) -> User {
        User { id, name, email }
    }
}

map3(
    User::new,
    field::<_, (), ()>("id", vec![], integer()),
    field::<_, (), ()>("email", vec![], string()),
    field::<_, (), ()>("email", vec![], string()),
);