From dc579bf4a217edb1f82a6f1876622dced0596d8b Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Wed, 22 Nov 2023 10:34:32 +0100 Subject: [PATCH] add some docs --- src/day.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/day.rs b/src/day.rs index b7e10d6..9a92334 100644 --- a/src/day.rs +++ b/src/day.rs @@ -17,6 +17,8 @@ use std::str::FromStr; pub struct Day(u8); impl Day { + /// Creates a [`Day`] from the provided value if it's in the valid range, + /// returns [`None`] otherwise. pub fn new(day: u8) -> Option { if day == 0 || day > 25 { return None; @@ -29,6 +31,7 @@ impl Day { Self(day) } + /// Converts the [`Day`] into an [`u8`]. pub fn into_inner(self) -> u8 { self.0 } @@ -63,6 +66,7 @@ impl FromStr for Day { } } +/// An error which can be returned when parsing a [`Day`]. #[derive(Debug)] pub struct DayFromStrError;