pub struct NflData { /* private fields */ }Implementations§
Source§impl NflData
impl NflData
Sourcepub async fn data_revision(&self) -> Result<DataRevision, NflDataError>
pub async fn data_revision(&self) -> Result<DataRevision, NflDataError>
Read an opaque hint for changes in the complete nflverse freshness snapshot.
Source§impl NflData
impl NflData
Sourcepub async fn identify(
&self,
ids: &[NflPlayerId],
) -> Result<HashMap<NflPlayerId, PlayerIdentity>, NflDataError>
pub async fn identify( &self, ids: &[NflPlayerId], ) -> Result<HashMap<NflPlayerId, PlayerIdentity>, NflDataError>
Display facts per gsis id: players first, weekly rosters for the
misses; unknown ids are absent from the map.
Source§impl NflData
impl NflData
Sourcepub async fn players(&self) -> Result<Vec<Player>, NflDataError>
pub async fn players(&self) -> Result<Vec<Player>, NflDataError>
All cached players, ordered by name.
Sourcepub async fn weekly_roster(
&self,
season_week: SeasonWeek,
team: &TeamAbbr,
) -> Result<Vec<WeeklyRosterEntry>, NflDataError>
pub async fn weekly_roster( &self, season_week: SeasonWeek, team: &TeamAbbr, ) -> Result<Vec<WeeklyRosterEntry>, NflDataError>
A team’s cached roster for one week, ordered by player name.
Sourcepub async fn player_week_stats(
&self,
season_week: SeasonWeek,
) -> Result<Vec<PlayerWeekStats>, NflDataError>
pub async fn player_week_stats( &self, season_week: SeasonWeek, ) -> Result<Vec<PlayerWeekStats>, NflDataError>
All players’ cached stat lines for one week, ordered by player GSIS id.
Sourcepub async fn team_week_stats(
&self,
season_week: SeasonWeek,
) -> Result<Vec<TeamWeekStats>, NflDataError>
pub async fn team_week_stats( &self, season_week: SeasonWeek, ) -> Result<Vec<TeamWeekStats>, NflDataError>
All teams’ pbp-derived DST lines for one week (sacks, takeaways, TDs, blocks, conversion returns, and points_allowed = the opponent’s offensive points). Ordered by team.
Source§impl NflData
impl NflData
Sourcepub fn start_background_tasks(self: &Arc<Self>)
pub fn start_background_tasks(self: &Arc<Self>)
Start configured internal background work. Repeated calls are safe: the scheduler refreshes upstream datasets when configured, and the notification task republishes the snapshot after each relevant sync.
Sourcepub fn stop_background_tasks(&self)
pub fn stop_background_tasks(&self)
Stop future automatic task triggers without cancelling an active refresh. The notification task keeps running: aborting it here would make a later start unable to restore its receiver.
Source§impl NflData
impl NflData
Sourcepub async fn connect(config: NflDataConfig) -> Result<Self, NflDataError>
pub async fn connect(config: NflDataConfig) -> Result<Self, NflDataError>
Opens all databases, runs their migrations, reconciles the configured
season’s slates, and builds the initial snapshot. Any failure is a
connection error; background work starts only through
Self::start_background_tasks.
Sourcepub async fn in_memory() -> Result<Self, NflDataError>
pub async fn in_memory() -> Result<Self, NflDataError>
A fresh, empty, in-memory cache: migrations applied, nothing synced. Nothing builds a snapshot behind the caller’s back: seeding tests republish explicitly.
Sourcepub fn season(&self) -> Season
pub fn season(&self) -> Season
The application season this handle carries, from its configuration.
pub fn snapshot(&self) -> Arc<Snapshot> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NflData
impl !RefUnwindSafe for NflData
impl !UnwindSafe for NflData
impl Send for NflData
impl Sync for NflData
impl Unpin for NflData
impl UnsafeUnpin for NflData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more