Skip to content

Commit 57567b3

Browse files
committed
Tweak WeekdaySet docs
1 parent 97d6c63 commit 57567b3

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/weekday_set.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::{
55

66
use crate::Weekday;
77

8-
/// A collection of `Weekday`s stored as a single byte.
8+
/// A collection of [`Weekday`]s stored as a single byte.
99
///
1010
/// This type is `Copy` and provides efficient set-like and slice-like operations.
1111
/// Many operations are `const` as well.
@@ -15,7 +15,7 @@ use crate::Weekday;
1515
pub struct WeekdaySet(u8); // Invariant: the 8-th bit is always 0.
1616

1717
impl WeekdaySet {
18-
/// Create a `WeekdaySet` from an array of `Weekday`s.
18+
/// Create a `WeekdaySet` from an array of [`Weekday`]s.
1919
///
2020
/// # Example
2121
/// ```
@@ -35,7 +35,7 @@ impl WeekdaySet {
3535
acc
3636
}
3737

38-
/// Create a `WeekdaySet` from a single `Weekday`.
38+
/// Create a `WeekdaySet` from a single [`Weekday`].
3939
pub const fn single(weekday: Weekday) -> Self {
4040
match weekday {
4141
Weekday::Mon => Self(0b000_0001),
@@ -183,23 +183,15 @@ impl WeekdaySet {
183183
/// Returns a tuple `(before, after)`. `before` contains all days starting from Monday
184184
/// up to but __not__ including `weekday`. `after` contains all days starting from `weekday`
185185
/// up to and including Sunday.
186-
///
187-
/// # Example
188-
/// ```ignore
189-
/// # use chrono::WeekdaySet;
190-
/// use chrono::Weekday::*;
191-
/// let (before, after) = WeekdaySet::ALL.split_at(Fri);
192-
/// assert_eq!(before, WeekdaySet::from_array([Mon, Tue, Wed, Thu]));
193-
/// assert_eq!(after, WeekdaySet::from_array([Fri, Sat, Sun]));
194-
/// ```
195186
const fn split_at(self, weekday: Weekday) -> (Self, Self) {
196187
let days_after = 0b1000_0000 - Self::single(weekday).0;
197188
let days_before = days_after ^ 0b0111_1111;
198189
(Self(self.0 & days_before), Self(self.0 & days_after))
199190
}
200191

201-
/// Iterate over the `Weekday`s in the collection, starting from a given day
202-
/// and wrapping around from Sunday to Monday.
192+
/// Iterate over the [`Weekday`]s in the collection starting from a given day.
193+
///
194+
/// Wraps around from Sunday to Monday if necessary.
203195
///
204196
/// # Example
205197
/// ```

0 commit comments

Comments
 (0)