mlb_api/requests/meta/
pitch_codes.rs1use serde::Deserialize;
2
3id!(#[doc = "A [`String`] representing a pitch, such as \"F\" for Foul, \"S\" for Swinging Strike, etc."] PitchCodeId { code: String });
4
5#[must_use]
6pub fn unknown_pitch_code() -> PitchCodeId {
7 PitchCodeId::new("N")
8}
9
10#[allow(clippy::struct_excessive_bools, reason = "false positive")]
29#[derive(Debug, Deserialize, Clone)]
30#[serde(rename_all = "camelCase")]
31pub struct PitchCode {
32 pub description: String,
33 #[serde(rename = "swingStatus")]
34 pub has_swing: bool,
35 #[serde(rename = "swingMissStatus")]
36 pub is_whiff: bool,
37 #[serde(rename = "swingContactStatus")]
38 pub made_contact_fair: bool,
39 #[serde(rename = "strikeStatus")]
40 pub is_strike: bool,
41 #[serde(rename = "ballStatus")]
42 pub is_ball: bool,
43 #[serde(rename = "pitchStatus")]
44 pub is_pitch: bool,
45 pub pitch_result_text: String,
46 #[serde(rename = "buntAttemptStatus")]
47 pub is_bunt_attempt: bool,
48 #[serde(rename = "contactStatus")]
49 pub made_contact: bool,
50 #[serde(flatten)]
51 pub id: PitchCodeId,
52}
53
54id_only_eq_impl!(PitchCode, id);
55meta_kind_impl!("pitchCodes" => PitchCode);
56tiered_request_entry_cache_impl!(PitchCode.id: PitchCodeId);
57test_impl!(PitchCode);