Skip to main content

NflData

Struct NflData 

Source
pub struct NflData { /* private fields */ }

Implementations§

Source§

impl NflData

Source

pub async fn data_revision(&self) -> Result<DataRevision, NflDataError>

Read an opaque hint for changes in the complete nflverse freshness snapshot.

Source§

impl NflData

Source

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

Source

pub async fn players(&self) -> Result<Vec<Player>, NflDataError>

All cached players, ordered by name.

Source

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.

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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.

Source

pub fn season(&self) -> Season

The application season this handle carries, from its configuration.

Source

pub fn snapshot(&self) -> Arc<Snapshot> ⓘ

Trait Implementations§

Source§

impl Drop for NflData

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more