File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,32 @@ impl Weekdays {
228
228
Self ( self . 0 & !other. 0 )
229
229
}
230
230
231
+ /// Returns `true` if `other` contains all days in `self`.
232
+ ///
233
+ /// # Example
234
+ /// ```
235
+ /// # use chrono::Weekdays;
236
+ /// assert!(Weekdays::MON.is_subset(Weekdays::ALL));
237
+ /// assert!(!Weekdays::MON.is_subset(Weekdays::EMPTY));
238
+ /// assert!(Weekdays::EMPTY.is_subset(Weekdays::MON));
239
+ /// ```
240
+ pub const fn is_subset ( self , other : Self ) -> bool {
241
+ self . intersection ( other) . 0 == self . 0
242
+ }
243
+
244
+ /// Returns `true` if `self` contains all days in `other`.
245
+ ///
246
+ /// # Example
247
+ /// ```
248
+ /// # use chrono::Weekdays;
249
+ /// assert!(Weekdays::ALL.is_superset(Weekdays::MON));
250
+ /// assert!(Weekdays::MON.is_superset(Weekdays::EMPTY));
251
+ /// assert!(!Weekdays::MON.is_superset(Weekdays::TUE));
252
+ /// ```
253
+ pub const fn is_superset ( self , other : Self ) -> bool {
254
+ self . intersection ( other) . 0 == other. 0
255
+ }
256
+
231
257
/// Adds a day to the collection.
232
258
///
233
259
/// Returns `true` if the day was new to the collection.
You can’t perform that action at this time.
0 commit comments