pub struct SeasonWeek {
pub season: Season,
pub week: Week,
}Expand description
An NFL week identified by season year and absolute week number.
Weeks 1–18 are regular season and weeks 19–22 are postseason, so a week’s classification is derived from its number rather than stored alongside it.
Equality, ordering, hashing, and SQLx integer storage use the value returned by
encode.
§Examples
use nfl_model::{Season, SeasonWeek, Week};
let week = SeasonWeek {
season: Season(2026),
week: Week(1),
};
assert_eq!(week.encode(), 2_026_001);
assert_eq!(SeasonWeek::decode(2_026_001), Some(week));
assert!(!week.postseason());Fields§
§season: SeasonYear identifying the NFL season, including for postseason games in the next calendar year.
week: WeekAbsolute week number: 1–18 for the regular season, 19–22 for the postseason.
Implementations§
Source§impl SeasonWeek
impl SeasonWeek
Sourcepub fn new(season: Season, week: Week) -> Option<SeasonWeek>
pub fn new(season: Season, week: Week) -> Option<SeasonWeek>
Create a validated week from a season and an absolute week number.
Accepts weeks 1–22, where 1–18 are regular season and 19–22 are postseason (wild card,
divisional, championship, and Super Bowl). Returns None for 0 and for anything above 22.
Sourcepub fn from_week(week: Week) -> Option<SeasonWeek>
pub fn from_week(week: Week) -> Option<SeasonWeek>
Sourcepub fn postseason(&self) -> bool
pub fn postseason(&self) -> bool
Whether this week is a postseason week (week 19 or later).
Sourcepub fn for_season(season: Season) -> impl Iterator<Item = SeasonWeek>
pub fn for_season(season: Season) -> impl Iterator<Item = SeasonWeek>
Enumerate the weeks of a season in schedule-independent order: weeks 1–22.
Postseason weeks keep the supplied season year even when played in the next calendar year. Order reflects this canonical enumeration, not the NFL schedule.
Trait Implementations§
Source§impl Clone for SeasonWeek
impl Clone for SeasonWeek
Source§fn clone(&self) -> SeasonWeek
fn clone(&self) -> SeasonWeek
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SeasonWeek
Source§impl Debug for SeasonWeek
impl Debug for SeasonWeek
Source§impl<'r, DB> Decode<'r, DB> for SeasonWeekwhere
DB: Database,
i64: Decode<'r, DB>,
impl<'r, DB> Decode<'r, DB> for SeasonWeekwhere
DB: Database,
i64: Decode<'r, DB>,
Source§impl<'de> Deserialize<'de> for SeasonWeek
impl<'de> Deserialize<'de> for SeasonWeek
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SeasonWeek, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SeasonWeek, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<'q, DB> Encode<'q, DB> for SeasonWeekwhere
DB: Database,
i64: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for SeasonWeekwhere
DB: Database,
i64: Encode<'q, DB>,
Source§fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
impl Eq for SeasonWeek
Source§impl Hash for SeasonWeek
impl Hash for SeasonWeek
Source§impl Ord for SeasonWeek
impl Ord for SeasonWeek
Source§fn cmp(&self, other: &SeasonWeek) -> Ordering
fn cmp(&self, other: &SeasonWeek) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SeasonWeek
impl PartialEq for SeasonWeek
Source§impl PartialOrd for SeasonWeek
impl PartialOrd for SeasonWeek
Source§impl Serialize for SeasonWeek
impl Serialize for SeasonWeek
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<DB> Type<DB> for SeasonWeekwhere
DB: Database,
i64: Type<DB>,
impl<DB> Type<DB> for SeasonWeekwhere
DB: Database,
i64: Type<DB>,
Auto Trait Implementations§
impl Freeze for SeasonWeek
impl RefUnwindSafe for SeasonWeek
impl Send for SeasonWeek
impl Sync for SeasonWeek
impl Unpin for SeasonWeek
impl UnsafeUnpin for SeasonWeek
impl UnwindSafe for SeasonWeek
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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