From 0078bcf80988993b03778296ba712f63821a1d5f Mon Sep 17 00:00:00 2001 From: GrayJack Date: Mon, 18 Nov 2024 23:11:16 -0300 Subject: [PATCH] feat: Make `set`, `unset` and `toggle` const Rust 1.75.0 allows us to make functions with `&mut` const --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4dcaf815..bab2e3ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -596,20 +596,20 @@ fn bitflag_impl(attr: TokenStream, item: TokenStream) -> Result { /// Set the flags in `other` in the value. #[inline] #[doc(alias = "insert")] - pub fn set(&mut self, other: Self) { + pub const fn set(&mut self, other: Self) { self.0 = self.or(other).0 } /// Unset the flags in `other` in the value. #[inline] #[doc(alias = "remove")] - pub fn unset(&mut self, other: Self) { + pub const fn unset(&mut self, other: Self) { self.0 = self.difference(other).0 } /// Toggle the flags in `other` in the value. #[inline] - pub fn toggle(&mut self, other: Self) { + pub const fn toggle(&mut self, other: Self) { self.0 = self.xor(other).0 } }