Make KeyEvent::new a const fn (#606)
This commit is contained in:
parent
d638d15cd4
commit
fe5c303fcf
@ -395,7 +395,7 @@ pub struct KeyEvent {
|
||||
}
|
||||
|
||||
impl KeyEvent {
|
||||
pub fn new(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent {
|
||||
pub const fn new(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent {
|
||||
KeyEvent { code, modifiers }
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ impl Attributes {
|
||||
|
||||
/// Returns whether the attribute is set.
|
||||
#[inline(always)]
|
||||
pub fn has(self, attribute: Attribute) -> bool {
|
||||
pub const fn has(self, attribute: Attribute) -> bool {
|
||||
self.0 & attribute.bytes() != 0
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ impl Attributes {
|
||||
|
||||
/// Returns whether there is no attribute set.
|
||||
#[inline(always)]
|
||||
pub fn is_empty(self) -> bool {
|
||||
pub const fn is_empty(self) -> bool {
|
||||
self.0 == 0
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user