Skip to main content

roster_hydrations

Macro roster_hydrations 

Source
macro_rules! roster_hydrations {
    (@ inline_structs [person: { $($contents:tt)* } $(, $($rest:tt)*)?] $vis:vis struct $name:ident { $($field_tt:tt)* }) => { ... };
    (@ inline_structs [$marker:ident : { $($contents:tt)* } $(, $($rest:tt)*)?] $vis:vis struct $name:ident { $($field_tt:tt)* }) => { ... };
    (@ inline_structs [$marker:ident $(: $value:ty)? $(, $($rest:tt)*)?] $vis:vis struct $name:ident { $($field_tt:tt)* }) => { ... };
    (@ inline_structs [$(,)?] $vis:vis struct $name:ident { $($field_tt:tt)* }) => { ... };
    ($vis:vis struct $name:ident {
        $($contents:tt)*
    }) => { ... };
    (@ person_type $hydrations:path) => { ... };
    (@ person_type) => { ... };
    (@ actual $vis:vis struct $name:ident {
        $(person: $person:ty ,)?
    }) => { ... };
}
Expand description

Creates hydrations for a RosterRequest.

§Roster Hydrations

NameType
personperson_hydrations!

§Examples

person_hydrations! {
    pub struct ExamplePersonHydrations {
        nicknames
    }
}

roster_hydrations! {
    pub struct ExampleRosterHydrations {
        person: ExamplePersonHydrations
    }
}

// alternatively you can inline these hydrations
roster_hydrations! {
    pub struct ExampleRosterHydrations {
        person: { nicknames }
    }
}

let request = RosterRequest::<ExamplePersonHydrations>::builder()
    .team_id(141)
    .hydrations(ExampleRosterHydrations::builder()
        .person(ExamplePersonHydrations::builder()
            .build())
        .build())
    .build();
let response = request.get();

// note that assuming there isn't anything required to be specified, Default can be used on these builders
let request = RosterRequest::<ExamplePersonHydrations>::builder()
    .team_id(141)
    .hydrations(ExampleRosterHydrationsRequestData::default())
    .build();