Skip to main content

person_hydrations

Macro person_hydrations 

Source
macro_rules! person_hydrations {
    (@ inline_structs [stats: { $($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)* }) => { ... };
    (@ actual
		$vis:vis struct $name:ident {
			$(awards $awards_comma:tt)?
			$(current_team $current_team_comma:tt)?
			$(depth_charts $depth_charts_comma:tt)?
			$(draft $draft_comma:tt)?
			$(education $education_comma:tt)?
			$(jobs $jobs_comma:tt)?
			$(nicknames $nicknames_comma:tt)?
			$(preferred_team $preferred_team_comma:tt)?
			$(relatives $relatives_comma:tt)?
			$(roster_entries $roster_entries_comma:tt)?
			$(transactions $transactions_comma:tt)?
			$(social $social_comma:tt)?
			$(stats: $stats:ty ,)?
			$(external_references $external_references_comma:tt)?
		}
    ) => { ... };
    ($vis:vis struct $name:ident {
		$($tt:tt)*
	}) => { ... };
}
Expand description

Creates hydrations for a person

§Examples

 person_hydrations! {
     pub struct TestHydrations {  ->  pub struct TestHydrations {
         awards,                     ->      awards: Vec<Award>,
         social,                     ->      social: HashMap<String, Vec<String>>,
         stats: MyStats,             ->      stats: MyStats,
     }                               ->  }
 }

 person_hydrations! {
     pub struct TestHydrations {        ->  pub struct TestHydrations {
         stats: { [Season] + [Hitting] },  ->      stats: TestHydrationsInlineStats,
     }                                     ->  }
 }

 let request = PersonRequest::<TestHydrations>::builder()
     .id(660_271)
     .hydrations(TestHydrations::builder())
     .build();

 let response = request.get().await.unwrap();

§Person Hydrations

Note: Fields must appear in exactly this order (or be omitted)

NameType
awardsVec<Award>
current_teamTeam
depth_chartsVec<RosterEntry>
draftVec<DraftPick>
educationEducation
jobsVec<EmployedPerson>
nicknamesVec<String>
preferred_teamTeam
relativesVec<Relative>
roster_entriesVec<RosterEntry>
transactionsVec<Transaction>
socialHashMap<String, Vec<String>>
statsstats_hydrations!
external_referencesVec<ExternalReference>