mlb_api/requests/stats/wrappers/
accumulated_vs_team.rs1use crate::game_types::GameType;
2use crate::person::NamedPerson;
3use crate::stats::wrappers::{AccumulatedMatchup, BatterPiece, GameTypePiece, OpposingTeamPiece, TeamPiece};
4use crate::stats::{RawStat, SingletonSplitStat};
5use crate::team::NamedTeam;
6use derive_more::{Deref, DerefMut};
7use serde::Deserialize;
8
9#[derive(Debug, Deserialize, PartialEq, Eq, Clone, Deref, DerefMut)]
10#[serde(rename_all = "camelCase")]
11#[serde(bound = "T: RawStat")]
12pub struct AccumulatedVsTeamTotalMatchup<T: RawStat> {
13 pub batter: NamedPerson,
14
15 #[deref]
16 #[deref_mut]
17 #[serde(flatten)]
18 inner: AccumulatedMatchup<T>,
19}
20
21impl<T: RawStat> OpposingTeamPiece for AccumulatedVsTeamTotalMatchup<T> {
22 fn opposing_team(&self) -> &NamedTeam {
23 &self.opposing_team
24 }
25}
26
27impl<T: RawStat> GameTypePiece for AccumulatedVsTeamTotalMatchup<T> {
28 fn game_type(&self) -> &GameType {
29 &self.game_type
30 }
31}
32
33impl<T: RawStat> TeamPiece for AccumulatedVsTeamTotalMatchup<T> {
34 fn team(&self) -> &NamedTeam {
35 &self.team
36 }
37}
38
39impl<T: RawStat> BatterPiece for AccumulatedVsTeamTotalMatchup<T> {
40 fn batter(&self) -> &NamedPerson {
41 &self.batter
42 }
43}
44
45impl<T: RawStat> Default for AccumulatedVsTeamTotalMatchup<T> {
46 fn default() -> Self {
47 Self {
48 batter: NamedPerson::unknown_person(),
49
50 inner: AccumulatedMatchup::default(),
51 }
52 }
53}
54
55impl<T: RawStat> SingletonSplitStat for AccumulatedVsTeamTotalMatchup<T> {}