Skip to main content

Module stats

Module stats 

Source
Expand description

§The Stats API

The second most likely reason you’re here.

mlb_api’s stats system designed to be simple to use. Create a stats type, then create the hydrations which have stats in it, then request it.

Almost all the types here are for private use and occasionally might be

§Examples

See stats_hydrations! for examples on how to use the macro.

§Notes

  1. The stat type registry is admittedly incomplete, only some stat types are implemented (see [stat_types]), more will come in the future.
  2. Some stats are only implemented for specific StatGroups, if you have a complicated request such as:
stats_hydrations! {
    pub struct TechnicalStats {
        [Sabermetrics, Career] + [Hitting, Pitching, Fielding, Catching]
    }
}

stats.sabermetrics.fielding and .catching will be of type (). 3. It is an intentional decision that SituationCodes are not registered in an enum as if new cutting-edge situation-codes come out, this API being outdated shouldn’t limit in that factor.

Modules§

derived
leaders
List of the top players leading in each stat.

Structs§

FloatCountingStat
InningsPitched
PercentageStat
PlayStat
PlusStat
ThreeDecimalPlaceRateStat
TwoDecimalPlaceRateStat

Enums§

InningsPitchedFromStrError

Traits§

RawStat
Represents the types defined in [raw], not the wrapped final types. In the serialized format, this represents the stat field.
SingletonSplitStat
Represents types that are made from a single ‘split’ in the serialized format (able to be deserialized)
Stat

Type Aliases§

CountingStat
Ex: Hits
PitchStat