Skip to content

Commit abbcc1e

Browse files
authored
Update bitflags to 2.2.1 (#549)
1 parent f9440bc commit abbcc1e

File tree

9 files changed

+51
-29
lines changed

9 files changed

+51
-29
lines changed

cocoa-foundation/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ default-target = "x86_64-apple-darwin"
1414

1515
[dependencies]
1616
block = "0.1"
17-
bitflags = "1.0"
17+
bitflags = "2"
1818
libc = "0.2"
1919
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
2020
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" }

cocoa-foundation/src/foundation.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ impl NSDictionary for id {
613613
}
614614

615615
bitflags! {
616+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
616617
pub struct NSEnumerationOptions: libc::c_ulonglong {
617618
const NSEnumerationConcurrent = 1 << 0;
618619
const NSEnumerationReverse = 1 << 1;
@@ -792,6 +793,7 @@ impl NSRunLoop for id {
792793
}
793794

794795
bitflags! {
796+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
795797
pub struct NSURLBookmarkCreationOptions: NSUInteger {
796798
const NSURLBookmarkCreationPreferFileIDResolution = 1 << 8;
797799
const NSURLBookmarkCreationMinimalBookmark = 1 << 9;
@@ -804,6 +806,7 @@ bitflags! {
804806
pub type NSURLBookmarkFileCreationOptions = NSURLBookmarkCreationOptions;
805807

806808
bitflags! {
809+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
807810
pub struct NSURLBookmarkResolutionOptions: NSUInteger {
808811
const NSURLBookmarkResolutionWithoutUI = 1 << 8;
809812
const NSURLBookmarkResolutionWithoutMounting = 1 << 9;
@@ -1590,6 +1593,7 @@ impl NSData for id {
15901593
}
15911594

15921595
bitflags! {
1596+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
15931597
pub struct NSDataReadingOptions: libc::c_ulonglong {
15941598
const NSDataReadingMappedIfSafe = 1 << 0;
15951599
const NSDataReadingUncached = 1 << 1;
@@ -1598,6 +1602,7 @@ bitflags! {
15981602
}
15991603

16001604
bitflags! {
1605+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
16011606
pub struct NSDataBase64EncodingOptions: libc::c_ulonglong {
16021607
const NSDataBase64Encoding64CharacterLineLength = 1 << 0;
16031608
const NSDataBase64Encoding76CharacterLineLength = 1 << 1;
@@ -1607,19 +1612,22 @@ bitflags! {
16071612
}
16081613

16091614
bitflags! {
1615+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
16101616
pub struct NSDataBase64DecodingOptions: libc::c_ulonglong {
16111617
const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0;
16121618
}
16131619
}
16141620

16151621
bitflags! {
1622+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
16161623
pub struct NSDataWritingOptions: libc::c_ulonglong {
16171624
const NSDataWritingAtomic = 1 << 0;
16181625
const NSDataWritingWithoutOverwriting = 1 << 1;
16191626
}
16201627
}
16211628

16221629
bitflags! {
1630+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
16231631
pub struct NSDataSearchOptions: libc::c_ulonglong {
16241632
const NSDataSearchBackwards = 1 << 0;
16251633
const NSDataSearchAnchored = 1 << 1;

cocoa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ default-target = "x86_64-apple-darwin"
1414

1515
[dependencies]
1616
block = "0.1"
17-
bitflags = "1.0"
17+
bitflags = "2"
1818
libc = "0.2"
1919
cocoa-foundation = { default-features = false, path = "../cocoa-foundation", version = "0.2" }
2020
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }

cocoa/src/appkit.rs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ pub enum NSApplicationTerminateReply {
184184
}
185185

186186
bitflags! {
187+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
187188
pub struct NSApplicationPresentationOptions : NSUInteger {
188189
const NSApplicationPresentationDefault = 0;
189190
const NSApplicationPresentationAutoHideDock = 1 << 0;
@@ -202,6 +203,7 @@ bitflags! {
202203
}
203204

204205
bitflags! {
206+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
205207
pub struct NSWindowStyleMask: NSUInteger {
206208
const NSBorderlessWindowMask = 0;
207209
const NSTitledWindowMask = 1 << 0;
@@ -251,6 +253,7 @@ pub enum NSWindowToolbarStyle {
251253
}
252254

253255
bitflags! {
256+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
254257
pub struct NSWindowOrderingMode: NSInteger {
255258
const NSWindowAbove = 1;
256259
const NSWindowBelow = -1;
@@ -259,6 +262,7 @@ bitflags! {
259262
}
260263

261264
bitflags! {
265+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
262266
pub struct NSAlignmentOptions: libc::c_ulonglong {
263267
const NSAlignMinXInward = 1 << 0;
264268
const NSAlignMinYInward = 1 << 1;
@@ -279,18 +283,18 @@ bitflags! {
279283
const NSAlignWidthNearest = 1 << 20;
280284
const NSAlignHeightNearest = 1 << 21;
281285
const NSAlignRectFlipped = 1 << 63;
282-
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits
283-
| NSAlignmentOptions::NSAlignMaxXInward.bits
284-
| NSAlignmentOptions::NSAlignMinYInward.bits
285-
| NSAlignmentOptions::NSAlignMaxYInward.bits;
286-
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits
287-
| NSAlignmentOptions::NSAlignMaxXOutward.bits
288-
| NSAlignmentOptions::NSAlignMinYOutward.bits
289-
| NSAlignmentOptions::NSAlignMaxYOutward.bits;
290-
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits
291-
| NSAlignmentOptions::NSAlignMaxXNearest.bits
292-
| NSAlignmentOptions::NSAlignMinYNearest.bits
293-
| NSAlignmentOptions::NSAlignMaxYNearest.bits;
286+
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits()
287+
| NSAlignmentOptions::NSAlignMaxXInward.bits()
288+
| NSAlignmentOptions::NSAlignMinYInward.bits()
289+
| NSAlignmentOptions::NSAlignMaxYInward.bits();
290+
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits()
291+
| NSAlignmentOptions::NSAlignMaxXOutward.bits()
292+
| NSAlignmentOptions::NSAlignMinYOutward.bits()
293+
| NSAlignmentOptions::NSAlignMaxYOutward.bits();
294+
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits()
295+
| NSAlignmentOptions::NSAlignMaxXNearest.bits()
296+
| NSAlignmentOptions::NSAlignMinYNearest.bits()
297+
| NSAlignmentOptions::NSAlignMaxYNearest.bits();
294298
}
295299
}
296300

@@ -578,7 +582,7 @@ impl NSApplication for id {
578582
}
579583

580584
unsafe fn setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL {
581-
msg_send![self, setPresentationOptions:options.bits]
585+
msg_send![self, setPresentationOptions:options.bits()]
582586
}
583587

584588
unsafe fn presentationOptions_(self) -> NSApplicationPresentationOptions {
@@ -1041,6 +1045,7 @@ impl NSMenuItem for id {
10411045
pub type NSWindowDepth = libc::c_int;
10421046

10431047
bitflags! {
1048+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
10441049
pub struct NSWindowCollectionBehavior: NSUInteger {
10451050
const NSWindowCollectionBehaviorDefault = 0;
10461051
const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0;
@@ -1059,6 +1064,7 @@ bitflags! {
10591064
}
10601065

10611066
bitflags! {
1067+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
10621068
pub struct NSWindowOcclusionState: NSUInteger {
10631069
const NSWindowOcclusionStateVisible = 1 << 1;
10641070
}
@@ -1351,7 +1357,7 @@ impl NSWindow for id {
13511357
defer: BOOL,
13521358
) -> id {
13531359
msg_send![self, initWithContentRect:rect
1354-
styleMask:style.bits
1360+
styleMask:style.bits()
13551361
backing:backing as NSUInteger
13561362
defer:defer]
13571363
}
@@ -1365,7 +1371,7 @@ impl NSWindow for id {
13651371
screen: id,
13661372
) -> id {
13671373
msg_send![self, initWithContentRect:rect
1368-
styleMask:style.bits
1374+
styleMask:style.bits()
13691375
backing:backing as NSUInteger
13701376
defer:defer
13711377
screen:screen]
@@ -1378,7 +1384,7 @@ impl NSWindow for id {
13781384
}
13791385

13801386
unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask) {
1381-
msg_send![self, setStyleMask:styleMask.bits]
1387+
msg_send![self, setStyleMask:styleMask.bits()]
13821388
}
13831389

13841390
unsafe fn toggleFullScreen_(self, sender: id) {
@@ -1507,23 +1513,23 @@ impl NSWindow for id {
15071513
windowFrame: NSRect,
15081514
windowStyle: NSWindowStyleMask,
15091515
) -> NSRect {
1510-
msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits]
1516+
msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits()]
15111517
}
15121518

15131519
unsafe fn frameRectForContentRect_styleMask_(
15141520
self,
15151521
windowContentRect: NSRect,
15161522
windowStyle: NSWindowStyleMask,
15171523
) -> NSRect {
1518-
msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits]
1524+
msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits()]
15191525
}
15201526

15211527
unsafe fn minFrameWidthWithTitle_styleMask_(
15221528
self,
15231529
windowTitle: id,
15241530
windowStyle: NSWindowStyleMask,
15251531
) -> CGFloat {
1526-
msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits]
1532+
msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits()]
15271533
}
15281534

15291535
unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect {
@@ -2517,6 +2523,7 @@ impl NSOpenGLContext for id {
25172523
}
25182524

25192525
bitflags! {
2526+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
25202527
pub struct NSEventSwipeTrackingOptions: NSUInteger {
25212528
const NSEventSwipeTrackingLockDirection = 0x1 << 0;
25222529
const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1;
@@ -2531,6 +2538,7 @@ pub enum NSEventGestureAxis {
25312538
}
25322539

25332540
bitflags! {
2541+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
25342542
pub struct NSEventPhase: NSUInteger {
25352543
const NSEventPhaseNone = 0;
25362544
const NSEventPhaseBegan = 0x1 << 0;
@@ -2543,15 +2551,16 @@ bitflags! {
25432551
}
25442552

25452553
bitflags! {
2554+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
25462555
pub struct NSTouchPhase: NSUInteger {
25472556
const NSTouchPhaseBegan = 1 << 0;
25482557
const NSTouchPhaseMoved = 1 << 1;
25492558
const NSTouchPhaseStationary = 1 << 2;
25502559
const NSTouchPhaseEnded = 1 << 3;
25512560
const NSTouchPhaseCancelled = 1 << 4;
2552-
const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits
2553-
| NSTouchPhase::NSTouchPhaseMoved.bits
2554-
| NSTouchPhase::NSTouchPhaseStationary.bits;
2561+
const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits()
2562+
| NSTouchPhase::NSTouchPhaseMoved.bits()
2563+
| NSTouchPhase::NSTouchPhaseStationary.bits();
25552564
const NSTouchPhaseAny = !0; // NSUIntegerMax
25562565
}
25572566
}
@@ -2592,6 +2601,7 @@ pub enum NSEventType {
25922601
}
25932602

25942603
bitflags! {
2604+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
25952605
pub struct NSEventMask: libc::c_ulonglong {
25962606
const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong;
25972607
const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong;
@@ -2628,13 +2638,12 @@ bitflags! {
26282638

26292639
impl NSEventMask {
26302640
pub fn from_type(ty: NSEventType) -> NSEventMask {
2631-
NSEventMask {
2632-
bits: 1 << ty as libc::c_ulonglong,
2633-
}
2641+
NSEventMask::from_bits_truncate(1 << ty as libc::c_ulonglong)
26342642
}
26352643
}
26362644

26372645
bitflags! {
2646+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
26382647
pub struct NSEventModifierFlags: NSUInteger {
26392648
const NSAlphaShiftKeyMask = 1 << 16;
26402649
const NSShiftKeyMask = 1 << 17;

cocoa/src/quartzcore.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ impl Filter {
11761176
}
11771177

11781178
bitflags! {
1179+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
11791180
pub struct EdgeAntialiasingMask: u32 {
11801181
const LEFT_EDGE = 1 << 0; // kCALayerLeftEdge
11811182
const RIGHT_EDGE = 1 << 1; // kCALayerRightEdge
@@ -1185,6 +1186,7 @@ bitflags! {
11851186
}
11861187

11871188
bitflags! {
1189+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
11881190
pub struct CornerMask: NSUInteger {
11891191
const MIN_X_MIN_Y_CORNER = 1 << 0; // kCALayerMinXMinYCorner
11901192
const MAX_X_MIN_Y_CORNER = 1 << 1; // kCALayerMaxXMinYCorner
@@ -1194,6 +1196,7 @@ bitflags! {
11941196
}
11951197

11961198
bitflags! {
1199+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
11971200
pub struct AutoresizingMask: u32 {
11981201
const NOT_SIZABLE = 0; // kCALayerNotSizable
11991202
const MIN_X_MARGIN = 1 << 0; // kCALayerMinXMargin

core-graphics-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
99
edition = "2018"
1010

1111
[dependencies]
12-
bitflags = "1.0"
12+
bitflags = "2"
1313
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
1414
libc = "0.2"
1515

core-graphics/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ highsierra = []
1616
link = ["core-foundation/link", "core-graphics-types/link"]
1717

1818
[dependencies]
19-
bitflags = "1.0"
19+
bitflags = "2"
2020
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
2121
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" }
2222
foreign-types = "0.5.0"

core-graphics/src/event.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bitflags! {
1818
///
1919
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
2020
#[repr(C)]
21+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
2122
pub struct CGEventFlags: u64 {
2223
const CGEventFlagNull = 0;
2324

core-graphics/src/gradient.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use libc::size_t;
2121

2222
bitflags! {
2323
#[repr(C)]
24+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
2425
pub struct CGGradientDrawingOptions: u32 {
2526
const CGGradientDrawsBeforeStartLocation = (1 << 0);
2627
const CGGradientDrawsAfterEndLocation = (1 << 1);

0 commit comments

Comments
 (0)