From 58972aef0a77f9a936fe93f3672e6d160ce9c048 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 24 Oct 2023 07:30:22 +0700 Subject: [PATCH] Update to 2018 edition. (#642) This is the minimum fix required. It updates to use crate-relative imports. --- cocoa-foundation/Cargo.toml | 1 + cocoa-foundation/src/foundation.rs | 4 +- cocoa/Cargo.toml | 1 + cocoa/src/appkit.rs | 6 +- cocoa/src/quartzcore.rs | 8 +- core-foundation-sys/Cargo.toml | 1 + core-foundation-sys/src/array.rs | 4 +- core-foundation-sys/src/attributed_string.rs | 8 +- core-foundation-sys/src/bag.rs | 4 +- core-foundation-sys/src/base.rs | 2 +- core-foundation-sys/src/binary_heap.rs | 4 +- core-foundation-sys/src/bit_vector.rs | 2 +- core-foundation-sys/src/bundle.rs | 14 +- core-foundation-sys/src/calendar.rs | 8 +- core-foundation-sys/src/characterset.rs | 6 +- core-foundation-sys/src/data.rs | 2 +- core-foundation-sys/src/date.rs | 2 +- core-foundation-sys/src/date_formatter.rs | 8 +- core-foundation-sys/src/dictionary.rs | 4 +- core-foundation-sys/src/error.rs | 6 +- core-foundation-sys/src/file_security.rs | 6 +- core-foundation-sys/src/filedescriptor.rs | 6 +- core-foundation-sys/src/locale.rs | 10 +- core-foundation-sys/src/mach_port.rs | 8 +- core-foundation-sys/src/messageport.rs | 10 +- .../src/notification_center.rs | 6 +- core-foundation-sys/src/number.rs | 2 +- core-foundation-sys/src/number_formatter.rs | 8 +- core-foundation-sys/src/plugin.rs | 12 +- core-foundation-sys/src/preferences.rs | 10 +- core-foundation-sys/src/propertylist.rs | 10 +- core-foundation-sys/src/runloop.rs | 10 +- core-foundation-sys/src/set.rs | 4 +- core-foundation-sys/src/socket.rs | 12 +- core-foundation-sys/src/stream.rs | 12 +- core-foundation-sys/src/string.rs | 12 +- core-foundation-sys/src/string_tokenizer.rs | 8 +- core-foundation-sys/src/timezone.rs | 16 +- core-foundation-sys/src/tree.rs | 4 +- core-foundation-sys/src/url.rs | 14 +- core-foundation-sys/src/url_enumerator.rs | 8 +- core-foundation-sys/src/user_notification.rs | 12 +- core-foundation-sys/src/uuid.rs | 4 +- core-foundation-sys/src/xml_node.rs | 12 +- core-foundation-sys/src/xml_parser.rs | 12 +- core-foundation/Cargo.toml | 1 + core-foundation/src/array.rs | 16 +- core-foundation/src/attributed_string.rs | 4 +- core-foundation/src/base.rs | 6 +- core-foundation/src/boolean.rs | 2 +- core-foundation/src/bundle.rs | 20 +- core-foundation/src/characterset.rs | 2 +- core-foundation/src/data.rs | 2 +- core-foundation/src/date.rs | 2 +- core-foundation/src/dictionary.rs | 14 +- core-foundation/src/error.rs | 4 +- core-foundation/src/filedescriptor.rs | 6 +- core-foundation/src/lib.rs | 2 +- core-foundation/src/mach_port.rs | 4 +- core-foundation/src/number.rs | 2 +- core-foundation/src/propertylist.rs | 34 +-- core-foundation/src/runloop.rs | 12 +- core-foundation/src/set.rs | 2 +- core-foundation/src/string.rs | 2 +- core-foundation/src/timezone.rs | 6 +- core-foundation/src/url.rs | 4 +- core-foundation/src/uuid.rs | 2 +- core-graphics-types/Cargo.toml | 1 + core-graphics-types/src/geometry.rs | 6 +- core-graphics/Cargo.toml | 1 + core-graphics/src/access.rs | 2 +- core-graphics/src/color.rs | 4 +- core-graphics/src/color_space.rs | 8 +- core-graphics/src/context.rs | 197 +++++++++--------- core-graphics/src/data_provider.rs | 6 +- core-graphics/src/display.rs | 44 ++-- core-graphics/src/event.rs | 56 ++--- core-graphics/src/event_source.rs | 4 +- core-graphics/src/font.rs | 32 +-- core-graphics/src/gradient.rs | 16 +- core-graphics/src/image.rs | 37 ++-- core-graphics/src/path.rs | 13 +- core-graphics/src/private.rs | 4 +- core-graphics/src/window.rs | 6 +- core-text/Cargo.toml | 1 + core-text/src/font.rs | 10 +- core-text/src/font_collection.rs | 8 +- core-text/src/line.rs | 2 +- core-text/src/run.rs | 6 +- io-surface/Cargo.toml | 1 + 90 files changed, 485 insertions(+), 452 deletions(-) diff --git a/cocoa-foundation/Cargo.toml b/cocoa-foundation/Cargo.toml index b176f8208..ea4759b6b 100644 --- a/cocoa-foundation/Cargo.toml +++ b/cocoa-foundation/Cargo.toml @@ -7,6 +7,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.1.2" authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" +edition = "2018" [package.metadata.docs.rs] default-target = "x86_64-apple-darwin" diff --git a/cocoa-foundation/src/foundation.rs b/cocoa-foundation/src/foundation.rs index c3661f07d..881b2c6d9 100644 --- a/cocoa-foundation/src/foundation.rs +++ b/cocoa-foundation/src/foundation.rs @@ -9,7 +9,7 @@ #![allow(non_upper_case_globals)] -use base::{id, nil, BOOL, NO, SEL}; +use crate::base::{id, nil, BOOL, NO, SEL}; use block::Block; use libc; use std::os::raw::c_void; @@ -32,7 +32,7 @@ const UTF8_ENCODING: usize = 4; #[cfg(target_os = "macos")] mod macos { - use base::id; + use crate::base::id; use core_graphics_types::base::CGFloat; use core_graphics_types::geometry::CGRect; use objc; diff --git a/cocoa/Cargo.toml b/cocoa/Cargo.toml index e46d8ed89..e68273d42 100644 --- a/cocoa/Cargo.toml +++ b/cocoa/Cargo.toml @@ -7,6 +7,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.25.0" authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" +edition = "2018" [package.metadata.docs.rs] default-target = "x86_64-apple-darwin" diff --git a/cocoa/src/appkit.rs b/cocoa/src/appkit.rs index bddfd3850..a3c7ae9e7 100644 --- a/cocoa/src/appkit.rs +++ b/cocoa/src/appkit.rs @@ -9,11 +9,11 @@ #![allow(non_upper_case_globals)] -use base::{id, BOOL, SEL}; -use block::Block; -use foundation::{ +use crate::base::{id, BOOL, SEL}; +use crate::foundation::{ NSInteger, NSPoint, NSRange, NSRect, NSRectEdge, NSSize, NSTimeInterval, NSUInteger, }; +use block::Block; use libc; pub use core_graphics::base::CGFloat; diff --git a/cocoa/src/quartzcore.rs b/cocoa/src/quartzcore.rs index dfa2918a4..eaf525cc7 100644 --- a/cocoa/src/quartzcore.rs +++ b/cocoa/src/quartzcore.rs @@ -24,9 +24,9 @@ use foreign_types::ForeignType; use std::ops::Mul; use std::ptr; -use appkit::CGLContextObj; -use base::{id, nil, BOOL, YES}; -use foundation::NSUInteger; +use crate::appkit::CGLContextObj; +use crate::base::{id, nil, BOOL, YES}; +use crate::foundation::NSUInteger; // CABase.h @@ -1356,7 +1356,7 @@ pub mod transaction { use core_foundation::date::CFTimeInterval; use core_foundation::string::CFString; - use base::{id, BOOL, YES}; + use crate::base::{id, BOOL, YES}; #[inline] pub fn begin() { diff --git a/core-foundation-sys/Cargo.toml b/core-foundation-sys/Cargo.toml index b1c13804a..656c3390d 100644 --- a/core-foundation-sys/Cargo.toml +++ b/core-foundation-sys/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.8.6" authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" +edition = "2018" [dependencies] diff --git a/core-foundation-sys/src/array.rs b/core-foundation-sys/src/array.rs index b9ce43c3e..1e521b3e4 100644 --- a/core-foundation-sys/src/array.rs +++ b/core-foundation-sys/src/array.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFComparatorFunction, CFIndex, CFRange, CFTypeID}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFComparatorFunction, CFIndex, CFRange, CFTypeID}; +use crate::string::CFStringRef; pub type CFArrayRetainCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void; diff --git a/core-foundation-sys/src/attributed_string.rs b/core-foundation-sys/src/attributed_string.rs index 93fbf63f2..54c27ec41 100644 --- a/core-foundation-sys/src/attributed_string.rs +++ b/core-foundation-sys/src/attributed_string.rs @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, CFTypeRef}; -use dictionary::CFDictionaryRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, CFTypeRef}; +use crate::dictionary::CFDictionaryRef; +use crate::string::CFMutableStringRef; +use crate::string::CFStringRef; use std::os::raw::c_void; -use string::CFMutableStringRef; -use string::CFStringRef; #[repr(C)] pub struct __CFAttributedString(c_void); diff --git a/core-foundation-sys/src/bag.rs b/core-foundation-sys/src/bag.rs index 143484101..041caa59c 100644 --- a/core-foundation-sys/src/bag.rs +++ b/core-foundation-sys/src/bag.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID}; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFBag(c_void); diff --git a/core-foundation-sys/src/base.rs b/core-foundation-sys/src/base.rs index 0bbd402c6..78e06a65f 100644 --- a/core-foundation-sys/src/base.rs +++ b/core-foundation-sys/src/base.rs @@ -7,9 +7,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::string::CFStringRef; use std::cmp::Ordering; use std::os::raw::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void}; -use string::CFStringRef; pub type Boolean = u8; pub type mach_port_t = c_uint; diff --git a/core-foundation-sys/src/binary_heap.rs b/core-foundation-sys/src/binary_heap.rs index 7bcb14464..8bcaa8e26 100644 --- a/core-foundation-sys/src/binary_heap.rs +++ b/core-foundation-sys/src/binary_heap.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID}; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFBinaryHeap(c_void); diff --git a/core-foundation-sys/src/bit_vector.rs b/core-foundation-sys/src/bit_vector.rs index 3072584b8..f270c3d1d 100644 --- a/core-foundation-sys/src/bit_vector.rs +++ b/core-foundation-sys/src/bit_vector.rs @@ -9,7 +9,7 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UInt32, UInt8}; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UInt32, UInt8}; #[repr(C)] pub struct __CFBitVector(c_void); diff --git a/core-foundation-sys/src/bundle.rs b/core-foundation-sys/src/bundle.rs index 8bc0010ef..60aaa4c77 100644 --- a/core-foundation-sys/src/bundle.rs +++ b/core-foundation-sys/src/bundle.rs @@ -9,15 +9,15 @@ use std::os::raw::c_void; -use array::CFArrayRef; +use crate::array::CFArrayRef; #[cfg(target_os = "macos")] -use base::SInt32; -use base::{Boolean, CFAllocatorRef, CFTypeID, CFTypeRef, UInt32}; -use dictionary::CFDictionaryRef; -use error::CFErrorRef; +use crate::base::SInt32; +use crate::base::{Boolean, CFAllocatorRef, CFTypeID, CFTypeRef, UInt32}; +use crate::dictionary::CFDictionaryRef; +use crate::error::CFErrorRef; +use crate::string::CFStringRef; +use crate::url::CFURLRef; use std::os::raw::{c_int, c_uint}; -use string::CFStringRef; -use url::CFURLRef; #[repr(C)] pub struct __CFBundle(c_void); diff --git a/core-foundation-sys/src/calendar.rs b/core-foundation-sys/src/calendar.rs index efae5d249..54c2a00cd 100644 --- a/core-foundation-sys/src/calendar.rs +++ b/core-foundation-sys/src/calendar.rs @@ -9,10 +9,10 @@ use std::os::raw::{c_char, c_void}; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID}; -use date::{CFAbsoluteTime, CFTimeInterval}; -use locale::{CFCalendarIdentifier, CFLocaleRef}; -use timezone::CFTimeZoneRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID}; +use crate::date::{CFAbsoluteTime, CFTimeInterval}; +use crate::locale::{CFCalendarIdentifier, CFLocaleRef}; +use crate::timezone::CFTimeZoneRef; #[repr(C)] pub struct __CFCalendar(c_void); diff --git a/core-foundation-sys/src/characterset.rs b/core-foundation-sys/src/characterset.rs index 19bb11fbd..8d75679af 100644 --- a/core-foundation-sys/src/characterset.rs +++ b/core-foundation-sys/src/characterset.rs @@ -7,10 +7,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UTF32Char}; -use data::CFDataRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UTF32Char}; +use crate::data::CFDataRef; +use crate::string::{CFStringRef, UniChar}; use std::os::raw::c_void; -use string::{CFStringRef, UniChar}; pub type CFCharacterSetPredefinedSet = CFIndex; diff --git a/core-foundation-sys/src/data.rs b/core-foundation-sys/src/data.rs index 639666990..ba87d0c5d 100644 --- a/core-foundation-sys/src/data.rs +++ b/core-foundation-sys/src/data.rs @@ -7,7 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID}; +use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID}; use std::os::raw::c_void; #[repr(C)] diff --git a/core-foundation-sys/src/date.rs b/core-foundation-sys/src/date.rs index c822eea8d..26b55d402 100644 --- a/core-foundation-sys/src/date.rs +++ b/core-foundation-sys/src/date.rs @@ -9,7 +9,7 @@ use std::os::raw::c_void; -use base::{CFAllocatorRef, CFComparisonResult, CFTypeID}; +use crate::base::{CFAllocatorRef, CFComparisonResult, CFTypeID}; #[repr(C)] pub struct __CFDate(c_void); diff --git a/core-foundation-sys/src/date_formatter.rs b/core-foundation-sys/src/date_formatter.rs index 41a54bb25..83c6e1fa7 100644 --- a/core-foundation-sys/src/date_formatter.rs +++ b/core-foundation-sys/src/date_formatter.rs @@ -9,10 +9,10 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef}; -use date::{CFAbsoluteTime, CFDateRef}; -use locale::CFLocaleRef; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef}; +use crate::date::{CFAbsoluteTime, CFDateRef}; +use crate::locale::CFLocaleRef; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFDateFormatter(c_void); diff --git a/core-foundation-sys/src/dictionary.rs b/core-foundation-sys/src/dictionary.rs index f243c5bab..8c04d680d 100644 --- a/core-foundation-sys/src/dictionary.rs +++ b/core-foundation-sys/src/dictionary.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID}; +use crate::string::CFStringRef; pub type CFDictionaryApplierFunction = extern "C" fn(key: *const c_void, value: *const c_void, context: *mut c_void); diff --git a/core-foundation-sys/src/error.rs b/core-foundation-sys/src/error.rs index 15f26bb16..e8ebd6c42 100644 --- a/core-foundation-sys/src/error.rs +++ b/core-foundation-sys/src/error.rs @@ -9,9 +9,9 @@ use std::os::raw::c_void; -use base::{CFAllocatorRef, CFIndex, CFTypeID}; -use dictionary::CFDictionaryRef; -use string::CFStringRef; +use crate::base::{CFAllocatorRef, CFIndex, CFTypeID}; +use crate::dictionary::CFDictionaryRef; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFError(c_void); diff --git a/core-foundation-sys/src/file_security.rs b/core-foundation-sys/src/file_security.rs index f9783e628..a4ec6112b 100644 --- a/core-foundation-sys/src/file_security.rs +++ b/core-foundation-sys/src/file_security.rs @@ -10,9 +10,9 @@ use std::os::raw::c_void; #[cfg(feature = "mac_os_10_8_features")] -use base::CFOptionFlags; -use base::{Boolean, CFAllocatorRef, CFTypeID}; -use uuid::CFUUIDRef; +use crate::base::CFOptionFlags; +use crate::base::{Boolean, CFAllocatorRef, CFTypeID}; +use crate::uuid::CFUUIDRef; #[repr(C)] pub struct __CFFileSecurity(c_void); diff --git a/core-foundation-sys/src/filedescriptor.rs b/core-foundation-sys/src/filedescriptor.rs index d2c81cd4f..271adb716 100644 --- a/core-foundation-sys/src/filedescriptor.rs +++ b/core-foundation-sys/src/filedescriptor.rs @@ -9,9 +9,9 @@ use std::os::raw::{c_int, c_void}; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID}; -use runloop::CFRunLoopSourceRef; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID}; +use crate::runloop::CFRunLoopSourceRef; +use crate::string::CFStringRef; pub type CFFileDescriptorNativeDescriptor = c_int; diff --git a/core-foundation-sys/src/locale.rs b/core-foundation-sys/src/locale.rs index 96cd765e5..f80e5c4a6 100644 --- a/core-foundation-sys/src/locale.rs +++ b/core-foundation-sys/src/locale.rs @@ -7,12 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use array::CFArrayRef; -use base::{CFAllocatorRef, CFIndex, CFTypeID, CFTypeRef, LangCode, RegionCode}; -use dictionary::CFDictionaryRef; -use notification_center::CFNotificationName; +use crate::array::CFArrayRef; +use crate::base::{CFAllocatorRef, CFIndex, CFTypeID, CFTypeRef, LangCode, RegionCode}; +use crate::dictionary::CFDictionaryRef; +use crate::notification_center::CFNotificationName; +use crate::string::CFStringRef; use std::os::raw::c_void; -use string::CFStringRef; #[repr(C)] pub struct __CFLocale(c_void); diff --git a/core-foundation-sys/src/mach_port.rs b/core-foundation-sys/src/mach_port.rs index 4ae67c053..1f47275de 100644 --- a/core-foundation-sys/src/mach_port.rs +++ b/core-foundation-sys/src/mach_port.rs @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{mach_port_t, Boolean}; -pub use base::{CFAllocatorRef, CFIndex, CFTypeID}; -use runloop::CFRunLoopSourceRef; +use crate::base::{mach_port_t, Boolean}; +pub use crate::base::{CFAllocatorRef, CFIndex, CFTypeID}; +use crate::runloop::CFRunLoopSourceRef; +use crate::string::CFStringRef; use std::os::raw::c_void; -use string::CFStringRef; #[repr(C)] pub struct __CFMachPort(c_void); diff --git a/core-foundation-sys/src/messageport.rs b/core-foundation-sys/src/messageport.rs index 91a5801b1..4ccdcc8b3 100644 --- a/core-foundation-sys/src/messageport.rs +++ b/core-foundation-sys/src/messageport.rs @@ -9,11 +9,11 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID, SInt32}; -use data::CFDataRef; -use date::CFTimeInterval; -use runloop::CFRunLoopSourceRef; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID, SInt32}; +use crate::data::CFDataRef; +use crate::date::CFTimeInterval; +use crate::runloop::CFRunLoopSourceRef; +use crate::string::CFStringRef; #[repr(C)] #[derive(Copy, Clone, Debug)] diff --git a/core-foundation-sys/src/notification_center.rs b/core-foundation-sys/src/notification_center.rs index b24058e03..2ed829233 100644 --- a/core-foundation-sys/src/notification_center.rs +++ b/core-foundation-sys/src/notification_center.rs @@ -9,9 +9,9 @@ use std::os::raw::c_void; -use base::{Boolean, CFIndex, CFOptionFlags, CFTypeID}; -use dictionary::CFDictionaryRef; -use string::CFStringRef; +use crate::base::{Boolean, CFIndex, CFOptionFlags, CFTypeID}; +use crate::dictionary::CFDictionaryRef; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFNotificationCenter(c_void); diff --git a/core-foundation-sys/src/number.rs b/core-foundation-sys/src/number.rs index ce174d5b6..d822d417d 100644 --- a/core-foundation-sys/src/number.rs +++ b/core-foundation-sys/src/number.rs @@ -9,7 +9,7 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID}; +use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID}; #[repr(C)] pub struct __CFBoolean(c_void); diff --git a/core-foundation-sys/src/number_formatter.rs b/core-foundation-sys/src/number_formatter.rs index 9bb03a359..cae7b11b0 100644 --- a/core-foundation-sys/src/number_formatter.rs +++ b/core-foundation-sys/src/number_formatter.rs @@ -9,10 +9,10 @@ use std::os::raw::{c_double, c_void}; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef}; -use locale::CFLocaleRef; -use number::{CFNumberRef, CFNumberType}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef}; +use crate::locale::CFLocaleRef; +use crate::number::{CFNumberRef, CFNumberType}; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFNumberFormatter(c_void); diff --git a/core-foundation-sys/src/plugin.rs b/core-foundation-sys/src/plugin.rs index 71263fa0c..fa236777c 100644 --- a/core-foundation-sys/src/plugin.rs +++ b/core-foundation-sys/src/plugin.rs @@ -9,12 +9,12 @@ use std::os::raw::c_void; -use array::CFArrayRef; -use base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; -use bundle::{CFBundleRef, CFPlugInRef}; -use string::CFStringRef; -use url::CFURLRef; -use uuid::CFUUIDRef; +use crate::array::CFArrayRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; +use crate::bundle::{CFBundleRef, CFPlugInRef}; +use crate::string::CFStringRef; +use crate::url::CFURLRef; +use crate::uuid::CFUUIDRef; #[repr(C)] pub struct __CFPlugInInstance(c_void); diff --git a/core-foundation-sys/src/preferences.rs b/core-foundation-sys/src/preferences.rs index eef8b30c3..0899938e5 100644 --- a/core-foundation-sys/src/preferences.rs +++ b/core-foundation-sys/src/preferences.rs @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use array::CFArrayRef; -use base::{Boolean, CFIndex}; -use dictionary::CFDictionaryRef; -use propertylist::CFPropertyListRef; -use string::CFStringRef; +use crate::array::CFArrayRef; +use crate::base::{Boolean, CFIndex}; +use crate::dictionary::CFDictionaryRef; +use crate::propertylist::CFPropertyListRef; +use crate::string::CFStringRef; extern "C" { /* diff --git a/core-foundation-sys/src/propertylist.rs b/core-foundation-sys/src/propertylist.rs index 8a5e7c3fa..d4ceb1b0c 100644 --- a/core-foundation-sys/src/propertylist.rs +++ b/core-foundation-sys/src/propertylist.rs @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeRef}; -use data::CFDataRef; -use error::CFErrorRef; -use stream::{CFReadStreamRef, CFWriteStreamRef}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeRef}; +use crate::data::CFDataRef; +use crate::error::CFErrorRef; +use crate::stream::{CFReadStreamRef, CFWriteStreamRef}; +use crate::string::CFStringRef; pub type CFPropertyListRef = CFTypeRef; diff --git a/core-foundation-sys/src/runloop.rs b/core-foundation-sys/src/runloop.rs index 9bc4896a9..5d5fda7a0 100644 --- a/core-foundation-sys/src/runloop.rs +++ b/core-foundation-sys/src/runloop.rs @@ -9,10 +9,12 @@ use std::os::raw::c_void; -use array::CFArrayRef; -use base::{mach_port_t, Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFOptionFlags, CFTypeID}; -use date::{CFAbsoluteTime, CFTimeInterval}; -use string::CFStringRef; +use crate::array::CFArrayRef; +use crate::base::{ + mach_port_t, Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFOptionFlags, CFTypeID, +}; +use crate::date::{CFAbsoluteTime, CFTimeInterval}; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFRunLoop(c_void); diff --git a/core-foundation-sys/src/set.rs b/core-foundation-sys/src/set.rs index 127e3989a..8141c5999 100644 --- a/core-foundation-sys/src/set.rs +++ b/core-foundation-sys/src/set.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID}; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID}; +use crate::string::CFStringRef; pub type CFSetApplierFunction = extern "C" fn(value: *const c_void, context: *const c_void); pub type CFSetRetainCallBack = diff --git a/core-foundation-sys/src/socket.rs b/core-foundation-sys/src/socket.rs index be9dc31f8..6fb70a108 100644 --- a/core-foundation-sys/src/socket.rs +++ b/core-foundation-sys/src/socket.rs @@ -9,12 +9,12 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32, UInt16}; -use data::CFDataRef; -use date::CFTimeInterval; -use propertylist::CFPropertyListRef; -use runloop::CFRunLoopSourceRef; -use string::CFStringRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32, UInt16}; +use crate::data::CFDataRef; +use crate::date::CFTimeInterval; +use crate::propertylist::CFPropertyListRef; +use crate::runloop::CFRunLoopSourceRef; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFSocket(c_void); diff --git a/core-foundation-sys/src/stream.rs b/core-foundation-sys/src/stream.rs index b35ca206c..922700e48 100644 --- a/core-foundation-sys/src/stream.rs +++ b/core-foundation-sys/src/stream.rs @@ -9,14 +9,14 @@ use std::os::raw::{c_int, c_void}; -use base::{ +use crate::base::{ Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, CFTypeRef, SInt32, UInt32, UInt8, }; -use error::CFErrorRef; -use runloop::CFRunLoopRef; -use socket::{CFSocketNativeHandle, CFSocketSignature}; -use string::CFStringRef; -use url::CFURLRef; +use crate::error::CFErrorRef; +use crate::runloop::CFRunLoopRef; +use crate::socket::{CFSocketNativeHandle, CFSocketSignature}; +use crate::string::CFStringRef; +use crate::url::CFURLRef; #[repr(C)] pub struct __CFReadStream(c_void); diff --git a/core-foundation-sys/src/string.rs b/core-foundation-sys/src/string.rs index 03e54dedb..2cb6ae948 100644 --- a/core-foundation-sys/src/string.rs +++ b/core-foundation-sys/src/string.rs @@ -7,15 +7,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use array::CFArrayRef; -use base::{ +use crate::array::CFArrayRef; +use crate::base::{ Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFOptionFlags, CFRange, CFTypeID, ConstStr255Param, ConstStringPtr, SInt32, StringPtr, UInt32, UInt8, UTF32Char, }; -use characterset::CFCharacterSetRef; -use data::CFDataRef; -use dictionary::CFDictionaryRef; -use locale::CFLocaleRef; +use crate::characterset::CFCharacterSetRef; +use crate::data::CFDataRef; +use crate::dictionary::CFDictionaryRef; +use crate::locale::CFLocaleRef; use std::os::raw::{c_char, c_double, c_ulong, c_ushort, c_void}; pub type CFStringCompareFlags = CFOptionFlags; diff --git a/core-foundation-sys/src/string_tokenizer.rs b/core-foundation-sys/src/string_tokenizer.rs index 45382cbeb..b23d6a2d3 100644 --- a/core-foundation-sys/src/string_tokenizer.rs +++ b/core-foundation-sys/src/string_tokenizer.rs @@ -9,10 +9,10 @@ use std::os::raw::c_void; -use array::CFMutableArrayRef; -use base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef}; -use locale::CFLocaleRef; -use string::CFStringRef; +use crate::array::CFMutableArrayRef; +use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef}; +use crate::locale::CFLocaleRef; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFStringTokenizer(c_void); diff --git a/core-foundation-sys/src/timezone.rs b/core-foundation-sys/src/timezone.rs index 95fbc9e71..076062a49 100644 --- a/core-foundation-sys/src/timezone.rs +++ b/core-foundation-sys/src/timezone.rs @@ -9,14 +9,14 @@ use std::os::raw::c_void; -use array::CFArrayRef; -use base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; -use data::CFDataRef; -use date::{CFAbsoluteTime, CFTimeInterval}; -use dictionary::CFDictionaryRef; -use locale::CFLocaleRef; -use notification_center::CFNotificationName; -use string::CFStringRef; +use crate::array::CFArrayRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; +use crate::data::CFDataRef; +use crate::date::{CFAbsoluteTime, CFTimeInterval}; +use crate::dictionary::CFDictionaryRef; +use crate::locale::CFLocaleRef; +use crate::notification_center::CFNotificationName; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFTimeZone(c_void); diff --git a/core-foundation-sys/src/tree.rs b/core-foundation-sys/src/tree.rs index 8219a7c9e..da6fdd607 100644 --- a/core-foundation-sys/src/tree.rs +++ b/core-foundation-sys/src/tree.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{CFAllocatorRef, CFComparatorFunction, CFIndex, CFTypeID}; -use string::CFStringRef; +use crate::base::{CFAllocatorRef, CFComparatorFunction, CFIndex, CFTypeID}; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFTree(c_void); diff --git a/core-foundation-sys/src/url.rs b/core-foundation-sys/src/url.rs index e98a4d7f3..2274d3608 100644 --- a/core-foundation-sys/src/url.rs +++ b/core-foundation-sys/src/url.rs @@ -9,12 +9,14 @@ use std::os::raw::c_void; -use array::CFArrayRef; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef, SInt32}; -use data::CFDataRef; -use dictionary::CFDictionaryRef; -use error::CFErrorRef; -use string::{CFStringEncoding, CFStringRef}; +use crate::array::CFArrayRef; +use crate::base::{ + Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef, SInt32, +}; +use crate::data::CFDataRef; +use crate::dictionary::CFDictionaryRef; +use crate::error::CFErrorRef; +use crate::string::{CFStringEncoding, CFStringRef}; #[repr(C)] pub struct __CFURL(c_void); diff --git a/core-foundation-sys/src/url_enumerator.rs b/core-foundation-sys/src/url_enumerator.rs index 7b15a414a..71b74beb5 100644 --- a/core-foundation-sys/src/url_enumerator.rs +++ b/core-foundation-sys/src/url_enumerator.rs @@ -9,10 +9,10 @@ use std::os::raw::c_void; -use array::CFArrayRef; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID}; -use error::CFErrorRef; -use url::CFURLRef; +use crate::array::CFArrayRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID}; +use crate::error::CFErrorRef; +use crate::url::CFURLRef; #[repr(C)] pub struct __CFURLEnumerator(c_void); diff --git a/core-foundation-sys/src/user_notification.rs b/core-foundation-sys/src/user_notification.rs index 654b35cd6..643271826 100644 --- a/core-foundation-sys/src/user_notification.rs +++ b/core-foundation-sys/src/user_notification.rs @@ -9,12 +9,12 @@ use std::os::raw::c_void; -use base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32}; -use date::CFTimeInterval; -use dictionary::CFDictionaryRef; -use runloop::CFRunLoopSourceRef; -use string::CFStringRef; -use url::CFURLRef; +use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32}; +use crate::date::CFTimeInterval; +use crate::dictionary::CFDictionaryRef; +use crate::runloop::CFRunLoopSourceRef; +use crate::string::CFStringRef; +use crate::url::CFURLRef; #[repr(C)] pub struct __CFUserNotification(c_void); diff --git a/core-foundation-sys/src/uuid.rs b/core-foundation-sys/src/uuid.rs index dc1edfbde..a1714a8a8 100644 --- a/core-foundation-sys/src/uuid.rs +++ b/core-foundation-sys/src/uuid.rs @@ -9,8 +9,8 @@ use std::os::raw::c_void; -use base::{CFAllocatorRef, CFTypeID}; -use string::CFStringRef; +use crate::base::{CFAllocatorRef, CFTypeID}; +use crate::string::CFStringRef; #[repr(C)] pub struct __CFUUID(c_void); diff --git a/core-foundation-sys/src/xml_node.rs b/core-foundation-sys/src/xml_node.rs index 5a08838c6..332beec82 100644 --- a/core-foundation-sys/src/xml_node.rs +++ b/core-foundation-sys/src/xml_node.rs @@ -9,12 +9,12 @@ use std::os::raw::{c_char, c_void}; -use array::CFArrayRef; -use base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; -use dictionary::CFDictionaryRef; -use string::{CFStringEncoding, CFStringRef}; -use tree::CFTreeRef; -use url::CFURLRef; +use crate::array::CFArrayRef; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; +use crate::dictionary::CFDictionaryRef; +use crate::string::{CFStringEncoding, CFStringRef}; +use crate::tree::CFTreeRef; +use crate::url::CFURLRef; #[repr(C)] pub struct __CFXMLNode(c_void); diff --git a/core-foundation-sys/src/xml_parser.rs b/core-foundation-sys/src/xml_parser.rs index e68cb8dca..32dc709a6 100644 --- a/core-foundation-sys/src/xml_parser.rs +++ b/core-foundation-sys/src/xml_parser.rs @@ -9,12 +9,12 @@ use std::os::raw::c_void; -use base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID}; -use data::CFDataRef; -use dictionary::CFDictionaryRef; -use string::CFStringRef; -use url::CFURLRef; -use xml_node::{CFXMLExternalID, CFXMLNodeRef, CFXMLTreeRef}; +use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID}; +use crate::data::CFDataRef; +use crate::dictionary::CFDictionaryRef; +use crate::string::CFStringRef; +use crate::url::CFURLRef; +use crate::xml_node::{CFXMLExternalID, CFXMLNodeRef, CFXMLTreeRef}; #[repr(C)] pub struct __CFXMLParser(c_void); diff --git a/core-foundation/Cargo.toml b/core-foundation/Cargo.toml index 02e56777a..1628ccdf9 100644 --- a/core-foundation/Cargo.toml +++ b/core-foundation/Cargo.toml @@ -8,6 +8,7 @@ authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" categories = ["os::macos-apis"] keywords = ["macos", "framework", "objc"] +edition = "2018" [dependencies.core-foundation-sys] path = "../core-foundation-sys" diff --git a/core-foundation/src/array.rs b/core-foundation/src/array.rs index 8f171739c..b6f5d5c74 100644 --- a/core-foundation/src/array.rs +++ b/core-foundation/src/array.rs @@ -9,6 +9,7 @@ //! Heterogeneous immutable arrays. +use crate::ConcreteCFType; pub use core_foundation_sys::array::*; pub use core_foundation_sys::base::CFIndex; use core_foundation_sys::base::{kCFAllocatorDefault, CFRelease, CFTypeRef}; @@ -16,10 +17,9 @@ use std::marker::PhantomData; use std::mem; use std::os::raw::c_void; use std::ptr; -use ConcreteCFType; -use base::{CFIndexConvertible, CFRange, TCFType}; -use base::{FromVoid, ItemRef}; +use crate::base::{CFIndexConvertible, CFRange, TCFType}; +use crate::base::{FromVoid, ItemRef}; /// A heterogeneous immutable array. pub struct CFArray(CFArrayRef, PhantomData); @@ -185,7 +185,7 @@ mod tests { use crate::number::CFNumber; use super::*; - use base::CFType; + use crate::base::CFType; use std::mem; #[test] @@ -216,7 +216,7 @@ mod tests { #[test] fn borrow() { - use string::CFString; + use crate::string::CFString; let string = CFString::from_static_string("alongerstring"); assert_eq!(string.retain_count(), 1); @@ -238,8 +238,8 @@ mod tests { #[test] fn iter_untyped_array() { - use base::TCFTypeRef; - use string::{CFString, CFStringRef}; + use crate::base::TCFTypeRef; + use crate::string::{CFString, CFStringRef}; let cf_string = CFString::from_static_string("alongerstring"); let array: CFArray = CFArray::from_CFTypes(&[cf_string.clone()]).into_untyped(); @@ -255,7 +255,7 @@ mod tests { #[test] fn should_box_and_unbox() { - use number::CFNumber; + use crate::number::CFNumber; let n0 = CFNumber::from(0); let n1 = CFNumber::from(1); diff --git a/core-foundation/src/attributed_string.rs b/core-foundation/src/attributed_string.rs index e7794d12b..6a2b349f1 100644 --- a/core-foundation/src/attributed_string.rs +++ b/core-foundation/src/attributed_string.rs @@ -9,10 +9,10 @@ pub use core_foundation_sys::attributed_string::*; -use base::TCFType; +use crate::base::TCFType; +use crate::string::{CFString, CFStringRef}; use core_foundation_sys::base::{kCFAllocatorDefault, CFIndex, CFRange}; use std::ptr::null; -use string::{CFString, CFStringRef}; declare_TCFType! { CFAttributedString, CFAttributedStringRef diff --git a/core-foundation/src/base.rs b/core-foundation/src/base.rs index 90105dc59..b44c1262a 100644 --- a/core-foundation/src/base.rs +++ b/core-foundation/src/base.rs @@ -17,8 +17,8 @@ use std::os::raw::c_void; pub use core_foundation_sys::base::*; -use string::CFString; -use ConcreteCFType; +use crate::string::CFString; +use crate::ConcreteCFType; pub trait CFIndexConvertible { /// Always use this method to construct a `CFIndex` value. It performs bounds checking to @@ -393,7 +393,7 @@ unsafe impl ToVoid for CFTypeRef { #[cfg(test)] mod tests { use super::*; - use boolean::CFBoolean; + use crate::boolean::CFBoolean; use std::mem; #[test] diff --git a/core-foundation/src/boolean.rs b/core-foundation/src/boolean.rs index 13606f97c..e0e2ff762 100644 --- a/core-foundation/src/boolean.rs +++ b/core-foundation/src/boolean.rs @@ -13,7 +13,7 @@ pub use core_foundation_sys::number::{ kCFBooleanFalse, kCFBooleanTrue, CFBooleanGetTypeID, CFBooleanRef, }; -use base::TCFType; +use crate::base::TCFType; declare_TCFType! { /// A Boolean type. diff --git a/core-foundation/src/bundle.rs b/core-foundation/src/bundle.rs index 183dc8e8e..f6d53a991 100644 --- a/core-foundation/src/bundle.rs +++ b/core-foundation/src/bundle.rs @@ -14,11 +14,11 @@ pub use core_foundation_sys::bundle::*; use core_foundation_sys::url::kCFURLPOSIXPathStyle; use std::path::PathBuf; -use base::{CFType, TCFType}; -use dictionary::CFDictionary; +use crate::base::{CFType, TCFType}; +use crate::dictionary::CFDictionary; +use crate::string::CFString; +use crate::url::CFURL; use std::os::raw::c_void; -use string::CFString; -use url::CFURL; declare_TCFType! { /// A Bundle type. @@ -148,8 +148,8 @@ impl CFBundle { #[test] fn safari_executable_url() { - use string::CFString; - use url::{kCFURLPOSIXPathStyle, CFURL}; + use crate::string::CFString; + use crate::url::{kCFURLPOSIXPathStyle, CFURL}; let cfstr_path = CFString::from_static_string("/Applications/Safari.app"); let cfurl_path = CFURL::from_file_system_path(cfstr_path, kCFURLPOSIXPathStyle, true); @@ -169,8 +169,8 @@ fn safari_executable_url() { #[test] fn safari_private_frameworks_url() { - use string::CFString; - use url::{kCFURLPOSIXPathStyle, CFURL}; + use crate::string::CFString; + use crate::url::{kCFURLPOSIXPathStyle, CFURL}; let cfstr_path = CFString::from_static_string("/Applications/Safari.app"); let cfurl_path = CFURL::from_file_system_path(cfstr_path, kCFURLPOSIXPathStyle, true); @@ -190,8 +190,8 @@ fn safari_private_frameworks_url() { #[test] fn non_existant_bundle() { - use string::CFString; - use url::{kCFURLPOSIXPathStyle, CFURL}; + use crate::string::CFString; + use crate::url::{kCFURLPOSIXPathStyle, CFURL}; let cfstr_path = CFString::from_static_string("/usr/local/foo"); let cfurl_path = CFURL::from_file_system_path(cfstr_path, kCFURLPOSIXPathStyle, true); diff --git a/core-foundation/src/characterset.rs b/core-foundation/src/characterset.rs index 28dba0b7f..2a05a931d 100644 --- a/core-foundation/src/characterset.rs +++ b/core-foundation/src/characterset.rs @@ -11,7 +11,7 @@ pub use core_foundation_sys::characterset::*; -use base::TCFType; +use crate::base::TCFType; declare_TCFType! { /// An immutable set of Unicde characters. diff --git a/core-foundation/src/data.rs b/core-foundation/src/data.rs index a955061ee..9f952199a 100644 --- a/core-foundation/src/data.rs +++ b/core-foundation/src/data.rs @@ -16,7 +16,7 @@ use std::ops::Deref; use std::slice; use std::sync::Arc; -use base::{CFIndexConvertible, TCFType}; +use crate::base::{CFIndexConvertible, TCFType}; declare_TCFType! { /// A byte buffer. diff --git a/core-foundation/src/date.rs b/core-foundation/src/date.rs index 49c07cc15..c27bad25d 100644 --- a/core-foundation/src/date.rs +++ b/core-foundation/src/date.rs @@ -12,7 +12,7 @@ use core_foundation_sys::base::kCFAllocatorDefault; pub use core_foundation_sys::date::*; -use base::TCFType; +use crate::base::TCFType; #[cfg(feature = "with-chrono")] use chrono::NaiveDateTime; diff --git a/core-foundation/src/dictionary.rs b/core-foundation/src/dictionary.rs index 90cd4a7b7..aad37f3c8 100644 --- a/core-foundation/src/dictionary.rs +++ b/core-foundation/src/dictionary.rs @@ -17,9 +17,9 @@ use std::mem; use std::os::raw::c_void; use std::ptr; -use base::{CFIndexConvertible, TCFType}; -use base::{FromVoid, ItemRef, ToVoid}; -use ConcreteCFType; +use crate::base::{CFIndexConvertible, TCFType}; +use crate::base::{FromVoid, ItemRef, ToVoid}; +use crate::ConcreteCFType; // consume the type parameters with PhantomDatas pub struct CFDictionary( @@ -350,10 +350,10 @@ impl<'a, K, V> From<&'a CFDictionary> for CFMutableDictionary { #[cfg(test)] pub mod test { use super::*; - use base::{CFType, TCFType}; - use boolean::CFBoolean; - use number::CFNumber; - use string::CFString; + use crate::base::{CFType, TCFType}; + use crate::boolean::CFBoolean; + use crate::number::CFNumber; + use crate::string::CFString; #[test] fn dictionary() { diff --git a/core-foundation/src/error.rs b/core-foundation/src/error.rs index 86319b0fe..e5a224259 100644 --- a/core-foundation/src/error.rs +++ b/core-foundation/src/error.rs @@ -14,8 +14,8 @@ pub use core_foundation_sys::error::*; use std::error::Error; use std::fmt; -use base::{CFIndex, TCFType}; -use string::CFString; +use crate::base::{CFIndex, TCFType}; +use crate::string::CFString; declare_TCFType! { /// An error value. diff --git a/core-foundation/src/filedescriptor.rs b/core-foundation/src/filedescriptor.rs index 6207489fd..876d1cec0 100644 --- a/core-foundation/src/filedescriptor.rs +++ b/core-foundation/src/filedescriptor.rs @@ -12,8 +12,8 @@ pub use core_foundation_sys::filedescriptor::*; use core_foundation_sys::base::{kCFAllocatorDefault, CFOptionFlags}; use core_foundation_sys::base::{Boolean, CFIndex}; -use base::TCFType; -use runloop::CFRunLoopSource; +use crate::base::TCFType; +use crate::runloop::CFRunLoopSource; use std::mem::MaybeUninit; use std::os::unix::io::{AsRawFd, RawFd}; @@ -100,10 +100,10 @@ mod test { extern crate libc; use super::*; + use crate::runloop::CFRunLoop; use core_foundation_sys::base::CFOptionFlags; use core_foundation_sys::runloop::kCFRunLoopDefaultMode; use libc::O_RDWR; - use runloop::CFRunLoop; use std::ffi::CString; use std::os::raw::c_void; diff --git a/core-foundation/src/lib.rs b/core-foundation/src/lib.rs index bdef988d1..767d45aad 100644 --- a/core-foundation/src/lib.rs +++ b/core-foundation/src/lib.rs @@ -21,7 +21,7 @@ extern crate libc; #[cfg(feature = "with-chrono")] extern crate chrono; -use base::TCFType; +use crate::base::TCFType; pub unsafe trait ConcreteCFType: TCFType {} diff --git a/core-foundation/src/mach_port.rs b/core-foundation/src/mach_port.rs index 776c4708c..f01847fff 100644 --- a/core-foundation/src/mach_port.rs +++ b/core-foundation/src/mach_port.rs @@ -1,7 +1,7 @@ -use base::TCFType; +use crate::base::TCFType; +use crate::runloop::CFRunLoopSource; use core_foundation_sys::base::kCFAllocatorDefault; pub use core_foundation_sys::mach_port::*; -use runloop::CFRunLoopSource; declare_TCFType! { /// An immutable numeric value. diff --git a/core-foundation/src/number.rs b/core-foundation/src/number.rs index 5d2240973..c3b6fab96 100644 --- a/core-foundation/src/number.rs +++ b/core-foundation/src/number.rs @@ -13,7 +13,7 @@ use core_foundation_sys::base::kCFAllocatorDefault; pub use core_foundation_sys::number::*; use std::os::raw::c_void; -use base::TCFType; +use crate::base::TCFType; declare_TCFType! { /// An immutable numeric value. diff --git a/core-foundation/src/propertylist.rs b/core-foundation/src/propertylist.rs index 651989db7..de5d1d87b 100644 --- a/core-foundation/src/propertylist.rs +++ b/core-foundation/src/propertylist.rs @@ -13,9 +13,9 @@ use std::mem; use std::os::raw::c_void; use std::ptr; -use base::{CFType, TCFType, TCFTypeRef}; -use data::CFData; -use error::CFError; +use crate::base::{CFType, TCFType, TCFTypeRef}; +use crate::data::CFData; +use crate::error::CFError; use core_foundation_sys::base::{ kCFAllocatorDefault, CFGetRetainCount, CFGetTypeID, CFIndex, CFRetain, CFShow, CFTypeID, @@ -87,13 +87,13 @@ pub trait CFPropertyListSubClass: TCFType { } } -impl CFPropertyListSubClass for ::data::CFData {} -impl CFPropertyListSubClass for ::string::CFString {} -impl CFPropertyListSubClass for ::array::CFArray {} -impl CFPropertyListSubClass for ::dictionary::CFDictionary {} -impl CFPropertyListSubClass for ::date::CFDate {} -impl CFPropertyListSubClass for ::boolean::CFBoolean {} -impl CFPropertyListSubClass for ::number::CFNumber {} +impl CFPropertyListSubClass for crate::data::CFData {} +impl CFPropertyListSubClass for crate::string::CFString {} +impl CFPropertyListSubClass for crate::array::CFArray {} +impl CFPropertyListSubClass for crate::dictionary::CFDictionary {} +impl CFPropertyListSubClass for crate::date::CFDate {} +impl CFPropertyListSubClass for crate::boolean::CFBoolean {} +impl CFPropertyListSubClass for crate::number::CFNumber {} declare_TCFType! { /// A CFPropertyList struct. This is superclass to [`CFData`], [`CFString`], [`CFArray`], @@ -249,17 +249,17 @@ impl CFPropertyList { #[cfg(test)] pub mod test { use super::*; - use boolean::CFBoolean; - use string::CFString; + use crate::boolean::CFBoolean; + use crate::string::CFString; #[test] fn test_property_list_serialization() { use super::*; - use base::{CFEqual, TCFType}; - use boolean::CFBoolean; - use dictionary::CFDictionary; - use number::CFNumber; - use string::CFString; + use crate::base::{CFEqual, TCFType}; + use crate::boolean::CFBoolean; + use crate::dictionary::CFDictionary; + use crate::number::CFNumber; + use crate::string::CFString; let bar = CFString::from_static_string("Bar"); let baz = CFString::from_static_string("Baz"); diff --git a/core-foundation/src/runloop.rs b/core-foundation/src/runloop.rs index 2c9a25b87..304c0716d 100644 --- a/core-foundation/src/runloop.rs +++ b/core-foundation/src/runloop.rs @@ -14,10 +14,10 @@ use core_foundation_sys::base::{kCFAllocatorDefault, CFOptionFlags}; pub use core_foundation_sys::runloop::*; use core_foundation_sys::string::CFStringRef; -use base::TCFType; -use date::{CFAbsoluteTime, CFTimeInterval}; -use filedescriptor::CFFileDescriptor; -use string::CFString; +use crate::base::TCFType; +use crate::date::{CFAbsoluteTime, CFTimeInterval}; +use crate::filedescriptor::CFFileDescriptor; +use crate::string::CFString; pub type CFRunLoopMode = CFStringRef; @@ -193,8 +193,8 @@ impl_TCFType!( #[cfg(test)] mod test { use super::*; - use base::Boolean; - use date::{CFAbsoluteTime, CFDate}; + use crate::base::Boolean; + use crate::date::{CFAbsoluteTime, CFDate}; use std::mem; use std::os::raw::c_void; use std::ptr::null_mut; diff --git a/core-foundation/src/set.rs b/core-foundation/src/set.rs index 83511efd5..641202de8 100644 --- a/core-foundation/src/set.rs +++ b/core-foundation/src/set.rs @@ -12,7 +12,7 @@ use core_foundation_sys::base::{kCFAllocatorDefault, CFRelease, CFTypeRef}; pub use core_foundation_sys::set::*; -use base::{CFIndexConvertible, TCFType}; +use crate::base::{CFIndexConvertible, TCFType}; use std::marker::PhantomData; use std::os::raw::c_void; diff --git a/core-foundation/src/string.rs b/core-foundation/src/string.rs index 33c1c17bb..3358bab55 100644 --- a/core-foundation/src/string.rs +++ b/core-foundation/src/string.rs @@ -11,7 +11,7 @@ pub use core_foundation_sys::string::*; -use base::{CFIndexConvertible, TCFType}; +use crate::base::{CFIndexConvertible, TCFType}; use core_foundation_sys::base::{kCFAllocatorDefault, kCFAllocatorNull}; use core_foundation_sys::base::{Boolean, CFIndex, CFRange}; diff --git a/core-foundation/src/timezone.rs b/core-foundation/src/timezone.rs index 009be7ebc..46123dcc2 100644 --- a/core-foundation/src/timezone.rs +++ b/core-foundation/src/timezone.rs @@ -12,9 +12,9 @@ use core_foundation_sys::base::kCFAllocatorDefault; pub use core_foundation_sys::timezone::*; -use base::TCFType; -use date::{CFDate, CFTimeInterval}; -use string::CFString; +use crate::base::TCFType; +use crate::date::{CFDate, CFTimeInterval}; +use crate::string::CFString; #[cfg(feature = "with-chrono")] use chrono::{FixedOffset, NaiveDateTime}; diff --git a/core-foundation/src/url.rs b/core-foundation/src/url.rs index 236d8dc1c..b92984438 100644 --- a/core-foundation/src/url.rs +++ b/core-foundation/src/url.rs @@ -11,8 +11,8 @@ pub use core_foundation_sys::url::*; -use base::{CFIndex, TCFType}; -use string::CFString; +use crate::base::{CFIndex, TCFType}; +use crate::string::CFString; use core_foundation_sys::base::{kCFAllocatorDefault, Boolean}; use std::fmt; diff --git a/core-foundation/src/uuid.rs b/core-foundation/src/uuid.rs index b70a41489..834a6dd9d 100644 --- a/core-foundation/src/uuid.rs +++ b/core-foundation/src/uuid.rs @@ -15,7 +15,7 @@ extern crate uuid; use core_foundation_sys::base::kCFAllocatorDefault; pub use core_foundation_sys::uuid::*; -use base::TCFType; +use crate::base::TCFType; #[cfg(feature = "with-uuid")] use self::uuid::Uuid; diff --git a/core-graphics-types/Cargo.toml b/core-graphics-types/Cargo.toml index a2f7b3a89..77b033594 100644 --- a/core-graphics-types/Cargo.toml +++ b/core-graphics-types/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.1.3" authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" +edition = "2018" [dependencies] bitflags = "1.0" diff --git a/core-graphics-types/src/geometry.rs b/core-graphics-types/src/geometry.rs index 356df1b3f..b585afdcb 100644 --- a/core-graphics-types/src/geometry.rs +++ b/core-graphics-types/src/geometry.rs @@ -7,7 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::CGFloat; +use crate::base::CGFloat; use core_foundation::base::TCFType; use core_foundation::dictionary::CFDictionary; @@ -162,9 +162,9 @@ impl CGAffineTransform { } mod ffi { - use base::{boolean_t, CGFloat}; + use crate::base::{boolean_t, CGFloat}; + use crate::geometry::{CGAffineTransform, CGPoint, CGRect, CGSize}; use core_foundation::dictionary::CFDictionaryRef; - use geometry::{CGAffineTransform, CGPoint, CGRect, CGSize}; #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { diff --git a/core-graphics/Cargo.toml b/core-graphics/Cargo.toml index addf73867..f0a1f5d4d 100644 --- a/core-graphics/Cargo.toml +++ b/core-graphics/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.23.1" authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" +edition = "2018" [features] default = ["link"] diff --git a/core-graphics/src/access.rs b/core-graphics/src/access.rs index cf51f9eb4..cd51acb04 100644 --- a/core-graphics/src/access.rs +++ b/core-graphics/src/access.rs @@ -1,4 +1,4 @@ -pub use base::boolean_t; +pub use crate::base::boolean_t; #[derive(Default)] pub struct ScreenCaptureAccess; diff --git a/core-graphics/src/color.rs b/core-graphics/src/color.rs index b91a4de22..f19a345a9 100644 --- a/core-graphics/src/color.rs +++ b/core-graphics/src/color.rs @@ -8,7 +8,7 @@ // except according to those terms. use super::sys::CGColorRef; -use base::CGFloat; +use crate::base::CGFloat; use core_foundation::base::CFTypeID; use core_foundation::base::TCFType; @@ -35,6 +35,6 @@ extern "C" { green: CGFloat, blue: CGFloat, alpha: CGFloat, - ) -> ::sys::CGColorRef; + ) -> crate::sys::CGColorRef; fn CGColorGetTypeID() -> CFTypeID; } diff --git a/core-graphics/src/color_space.rs b/core-graphics/src/color_space.rs index fc2f70bed..49ac5dc81 100644 --- a/core-graphics/src/color_space.rs +++ b/core-graphics/src/color_space.rs @@ -14,7 +14,7 @@ use foreign_types::ForeignType; foreign_type! { #[doc(hidden)] pub unsafe type CGColorSpace { - type CType = ::sys::CGColorSpace; + type CType = crate::sys::CGColorSpace; fn drop = |p| CFRelease(p as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -111,8 +111,8 @@ extern "C" { /// The name of the generic gray color space. pub static kCGColorSpaceGenericGray: CFStringRef; - fn CGColorSpaceCreateDeviceRGB() -> ::sys::CGColorSpaceRef; - fn CGColorSpaceCreateDeviceGray() -> ::sys::CGColorSpaceRef; - fn CGColorSpaceCreateWithName(name: CFStringRef) -> ::sys::CGColorSpaceRef; + fn CGColorSpaceCreateDeviceRGB() -> crate::sys::CGColorSpaceRef; + fn CGColorSpaceCreateDeviceGray() -> crate::sys::CGColorSpaceRef; + fn CGColorSpaceCreateWithName(name: CFStringRef) -> crate::sys::CGColorSpaceRef; fn CGColorSpaceGetTypeID() -> CFTypeID; } diff --git a/core-graphics/src/context.rs b/core-graphics/src/context.rs index 2671e8f33..9149fec73 100644 --- a/core-graphics/src/context.rs +++ b/core-graphics/src/context.rs @@ -7,20 +7,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::CGFloat; -use color::CGColor; -use color_space::CGColorSpace; +use crate::base::CGFloat; +use crate::color::CGColor; +use crate::color_space::CGColorSpace; +use crate::font::{CGFont, CGGlyph}; +use crate::geometry::{CGPoint, CGSize}; +use crate::gradient::{CGGradient, CGGradientDrawingOptions}; +use crate::path::CGPathRef; use core_foundation::base::{CFTypeID, TCFType}; -use font::{CGFont, CGGlyph}; -use geometry::{CGPoint, CGSize}; -use gradient::{CGGradient, CGGradientDrawingOptions}; use libc::{c_int, size_t}; -use path::CGPathRef; use std::os::raw::c_void; +use crate::geometry::{CGAffineTransform, CGRect}; +use crate::image::CGImage; use foreign_types::{ForeignType, ForeignTypeRef}; -use geometry::{CGAffineTransform, CGRect}; -use image::CGImage; use std::cmp; use std::ptr; use std::slice; @@ -110,7 +110,7 @@ pub enum CGInterpolationQuality { foreign_type! { #[doc(hidden)] pub unsafe type CGContext { - type CType = ::sys::CGContext; + type CType = crate::sys::CGContext; fn drop = |cs| CGContextRelease(cs); fn clone = |p| CGContextRetain(p); } @@ -132,7 +132,7 @@ impl CGContext { /// [`CGContextRef`]: https://developer.apple.com/documentation/coregraphics/cgcontextref /// [`CGRetain`]: https://developer.apple.com/documentation/coregraphics/1586506-cgcontextretain /// [`NSGraphicsContext::CGContext`]: https://developer.apple.com/documentation/appkit/nsgraphicscontext/1535352-currentcontext - pub unsafe fn from_existing_context_ptr(ctx: *mut ::sys::CGContext) -> CGContext { + pub unsafe fn from_existing_context_ptr(ctx: *mut crate::sys::CGContext) -> CGContext { CGContextRetain(ctx); Self::from_ptr(ctx) } @@ -588,7 +588,7 @@ impl CGContextRef { #[test] fn create_bitmap_context_test() { - use geometry::*; + use crate::geometry::*; let cs = CGColorSpace::create_device_rgb(); let ctx = CGContext::create_bitmap_context( @@ -598,7 +598,7 @@ fn create_bitmap_context_test() { 8, 0, &cs, - ::base::kCGImageAlphaPremultipliedLast, + crate::base::kCGImageAlphaPremultipliedLast, ); ctx.set_rgb_fill_color(1., 0., 1., 1.); ctx.set_miter_limit(4.); @@ -617,8 +617,8 @@ fn create_bitmap_context_test() { #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { - fn CGContextRetain(c: ::sys::CGContextRef) -> ::sys::CGContextRef; - fn CGContextRelease(c: ::sys::CGContextRef); + fn CGContextRetain(c: crate::sys::CGContextRef) -> crate::sys::CGContextRef; + fn CGContextRelease(c: crate::sys::CGContextRef); fn CGBitmapContextCreate( data: *mut c_void, @@ -626,55 +626,55 @@ extern "C" { height: size_t, bitsPerComponent: size_t, bytesPerRow: size_t, - space: ::sys::CGColorSpaceRef, + space: crate::sys::CGColorSpaceRef, bitmapInfo: u32, - ) -> ::sys::CGContextRef; - fn CGBitmapContextGetData(context: ::sys::CGContextRef) -> *mut c_void; - fn CGBitmapContextGetWidth(context: ::sys::CGContextRef) -> size_t; - fn CGBitmapContextGetHeight(context: ::sys::CGContextRef) -> size_t; - fn CGBitmapContextGetBytesPerRow(context: ::sys::CGContextRef) -> size_t; - fn CGBitmapContextCreateImage(context: ::sys::CGContextRef) -> ::sys::CGImageRef; + ) -> crate::sys::CGContextRef; + fn CGBitmapContextGetData(context: crate::sys::CGContextRef) -> *mut c_void; + fn CGBitmapContextGetWidth(context: crate::sys::CGContextRef) -> size_t; + fn CGBitmapContextGetHeight(context: crate::sys::CGContextRef) -> size_t; + fn CGBitmapContextGetBytesPerRow(context: crate::sys::CGContextRef) -> size_t; + fn CGBitmapContextCreateImage(context: crate::sys::CGContextRef) -> crate::sys::CGImageRef; fn CGContextGetTypeID() -> CFTypeID; - fn CGContextGetClipBoundingBox(c: ::sys::CGContextRef) -> CGRect; - fn CGContextFlush(c: ::sys::CGContextRef); - fn CGContextSetBlendMode(c: ::sys::CGContextRef, blendMode: CGBlendMode); - fn CGContextSetAllowsFontSmoothing(c: ::sys::CGContextRef, allowsFontSmoothing: bool); - fn CGContextSetShouldSmoothFonts(c: ::sys::CGContextRef, shouldSmoothFonts: bool); - fn CGContextSetFontSmoothingStyle(c: ::sys::CGContextRef, style: c_int); - fn CGContextSetAllowsAntialiasing(c: ::sys::CGContextRef, allowsAntialiasing: bool); - fn CGContextSetShouldAntialias(c: ::sys::CGContextRef, shouldAntialias: bool); + fn CGContextGetClipBoundingBox(c: crate::sys::CGContextRef) -> CGRect; + fn CGContextFlush(c: crate::sys::CGContextRef); + fn CGContextSetBlendMode(c: crate::sys::CGContextRef, blendMode: CGBlendMode); + fn CGContextSetAllowsFontSmoothing(c: crate::sys::CGContextRef, allowsFontSmoothing: bool); + fn CGContextSetShouldSmoothFonts(c: crate::sys::CGContextRef, shouldSmoothFonts: bool); + fn CGContextSetFontSmoothingStyle(c: crate::sys::CGContextRef, style: c_int); + fn CGContextSetAllowsAntialiasing(c: crate::sys::CGContextRef, allowsAntialiasing: bool); + fn CGContextSetShouldAntialias(c: crate::sys::CGContextRef, shouldAntialias: bool); fn CGContextSetAllowsFontSubpixelQuantization( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, allowsFontSubpixelQuantization: bool, ); fn CGContextSetShouldSubpixelQuantizeFonts( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, shouldSubpixelQuantizeFonts: bool, ); fn CGContextSetAllowsFontSubpixelPositioning( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, allowsFontSubpixelPositioning: bool, ); fn CGContextSetShouldSubpixelPositionFonts( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, shouldSubpixelPositionFonts: bool, ); - fn CGContextSetTextDrawingMode(c: ::sys::CGContextRef, mode: CGTextDrawingMode); - fn CGContextSetFillColorWithColor(c: ::sys::CGContextRef, color: ::sys::CGColorRef); - fn CGContextSetLineCap(c: ::sys::CGContextRef, cap: CGLineCap); + fn CGContextSetTextDrawingMode(c: crate::sys::CGContextRef, mode: CGTextDrawingMode); + fn CGContextSetFillColorWithColor(c: crate::sys::CGContextRef, color: crate::sys::CGColorRef); + fn CGContextSetLineCap(c: crate::sys::CGContextRef, cap: CGLineCap); fn CGContextSetLineDash( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, phase: CGFloat, lengths: *const CGFloat, count: size_t, ); - fn CGContextSetLineJoin(c: ::sys::CGContextRef, join: CGLineJoin); - fn CGContextSetLineWidth(c: ::sys::CGContextRef, width: CGFloat); - fn CGContextSetMiterLimit(c: ::sys::CGContextRef, limit: CGFloat); + fn CGContextSetLineJoin(c: crate::sys::CGContextRef, join: CGLineJoin); + fn CGContextSetLineWidth(c: crate::sys::CGContextRef, width: CGFloat); + fn CGContextSetMiterLimit(c: crate::sys::CGContextRef, limit: CGFloat); - fn CGContextAddPath(c: ::sys::CGContextRef, path: ::sys::CGPathRef); + fn CGContextAddPath(c: crate::sys::CGContextRef, path: crate::sys::CGPathRef); fn CGContextAddCurveToPoint( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, cp1x: CGFloat, cp1y: CGFloat, cp2x: CGFloat, @@ -683,86 +683,97 @@ extern "C" { y: CGFloat, ); fn CGContextAddQuadCurveToPoint( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, cpx: CGFloat, cpy: CGFloat, x: CGFloat, y: CGFloat, ); - fn CGContextAddLineToPoint(c: ::sys::CGContextRef, x: CGFloat, y: CGFloat); - fn CGContextBeginPath(c: ::sys::CGContextRef); - fn CGContextClosePath(c: ::sys::CGContextRef); - fn CGContextMoveToPoint(c: ::sys::CGContextRef, x: CGFloat, y: CGFloat); - fn CGContextDrawPath(c: ::sys::CGContextRef, mode: CGPathDrawingMode); - fn CGContextFillPath(c: ::sys::CGContextRef); - fn CGContextEOFillPath(c: ::sys::CGContextRef); - fn CGContextClip(c: ::sys::CGContextRef); - fn CGContextEOClip(c: ::sys::CGContextRef); - fn CGContextResetClip(c: ::sys::CGContextRef); - fn CGContextStrokePath(c: ::sys::CGContextRef); + fn CGContextAddLineToPoint(c: crate::sys::CGContextRef, x: CGFloat, y: CGFloat); + fn CGContextBeginPath(c: crate::sys::CGContextRef); + fn CGContextClosePath(c: crate::sys::CGContextRef); + fn CGContextMoveToPoint(c: crate::sys::CGContextRef, x: CGFloat, y: CGFloat); + fn CGContextDrawPath(c: crate::sys::CGContextRef, mode: CGPathDrawingMode); + fn CGContextFillPath(c: crate::sys::CGContextRef); + fn CGContextEOFillPath(c: crate::sys::CGContextRef); + fn CGContextClip(c: crate::sys::CGContextRef); + fn CGContextEOClip(c: crate::sys::CGContextRef); + fn CGContextResetClip(c: crate::sys::CGContextRef); + fn CGContextStrokePath(c: crate::sys::CGContextRef); fn CGContextSetRGBFillColor( - context: ::sys::CGContextRef, + context: crate::sys::CGContextRef, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ); fn CGContextSetRGBStrokeColor( - context: ::sys::CGContextRef, + context: crate::sys::CGContextRef, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ); - fn CGContextSetGrayFillColor(context: ::sys::CGContextRef, gray: CGFloat, alpha: CGFloat); - fn CGContextClearRect(context: ::sys::CGContextRef, rect: CGRect); - fn CGContextFillRect(context: ::sys::CGContextRef, rect: CGRect); - fn CGContextFillRects(context: ::sys::CGContextRef, rects: *const CGRect, count: size_t); - fn CGContextStrokeRect(context: ::sys::CGContextRef, rect: CGRect); - fn CGContextStrokeRectWithWidth(context: ::sys::CGContextRef, rect: CGRect, width: CGFloat); - fn CGContextClipToRect(context: ::sys::CGContextRef, rect: CGRect); - fn CGContextClipToRects(context: ::sys::CGContextRef, rects: *const CGRect, count: size_t); - fn CGContextClipToMask(ctx: ::sys::CGContextRef, rect: CGRect, mask: ::sys::CGImageRef); - fn CGContextReplacePathWithStrokedPath(context: ::sys::CGContextRef); - fn CGContextFillEllipseInRect(context: ::sys::CGContextRef, rect: CGRect); - fn CGContextStrokeEllipseInRect(context: ::sys::CGContextRef, rect: CGRect); + fn CGContextSetGrayFillColor(context: crate::sys::CGContextRef, gray: CGFloat, alpha: CGFloat); + fn CGContextClearRect(context: crate::sys::CGContextRef, rect: CGRect); + fn CGContextFillRect(context: crate::sys::CGContextRef, rect: CGRect); + fn CGContextFillRects(context: crate::sys::CGContextRef, rects: *const CGRect, count: size_t); + fn CGContextStrokeRect(context: crate::sys::CGContextRef, rect: CGRect); + fn CGContextStrokeRectWithWidth( + context: crate::sys::CGContextRef, + rect: CGRect, + width: CGFloat, + ); + fn CGContextClipToRect(context: crate::sys::CGContextRef, rect: CGRect); + fn CGContextClipToRects(context: crate::sys::CGContextRef, rects: *const CGRect, count: size_t); + fn CGContextClipToMask( + ctx: crate::sys::CGContextRef, + rect: CGRect, + mask: crate::sys::CGImageRef, + ); + fn CGContextReplacePathWithStrokedPath(context: crate::sys::CGContextRef); + fn CGContextFillEllipseInRect(context: crate::sys::CGContextRef, rect: CGRect); + fn CGContextStrokeEllipseInRect(context: crate::sys::CGContextRef, rect: CGRect); fn CGContextStrokeLineSegments( - context: ::sys::CGContextRef, + context: crate::sys::CGContextRef, points: *const CGPoint, count: size_t, ); - fn CGContextDrawImage(c: ::sys::CGContextRef, rect: CGRect, image: ::sys::CGImageRef); - fn CGContextSetInterpolationQuality(c: ::sys::CGContextRef, quality: CGInterpolationQuality); - fn CGContextGetInterpolationQuality(c: ::sys::CGContextRef) -> CGInterpolationQuality; - fn CGContextSetFont(c: ::sys::CGContextRef, font: ::sys::CGFontRef); - fn CGContextSetFontSize(c: ::sys::CGContextRef, size: CGFloat); - fn CGContextSetTextMatrix(c: ::sys::CGContextRef, t: CGAffineTransform); - fn CGContextSetTextPosition(c: ::sys::CGContextRef, x: CGFloat, y: CGFloat); + fn CGContextDrawImage(c: crate::sys::CGContextRef, rect: CGRect, image: crate::sys::CGImageRef); + fn CGContextSetInterpolationQuality( + c: crate::sys::CGContextRef, + quality: CGInterpolationQuality, + ); + fn CGContextGetInterpolationQuality(c: crate::sys::CGContextRef) -> CGInterpolationQuality; + fn CGContextSetFont(c: crate::sys::CGContextRef, font: crate::sys::CGFontRef); + fn CGContextSetFontSize(c: crate::sys::CGContextRef, size: CGFloat); + fn CGContextSetTextMatrix(c: crate::sys::CGContextRef, t: CGAffineTransform); + fn CGContextSetTextPosition(c: crate::sys::CGContextRef, x: CGFloat, y: CGFloat); fn CGContextShowGlyphsAtPositions( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, glyphs: *const CGGlyph, positions: *const CGPoint, count: size_t, ); - fn CGContextSaveGState(c: ::sys::CGContextRef); - fn CGContextRestoreGState(c: ::sys::CGContextRef); - fn CGContextTranslateCTM(c: ::sys::CGContextRef, tx: CGFloat, ty: CGFloat); - fn CGContextScaleCTM(c: ::sys::CGContextRef, sx: CGFloat, sy: CGFloat); - fn CGContextRotateCTM(c: ::sys::CGContextRef, angle: CGFloat); - fn CGContextGetCTM(c: ::sys::CGContextRef) -> CGAffineTransform; - fn CGContextConcatCTM(c: ::sys::CGContextRef, transform: CGAffineTransform); + fn CGContextSaveGState(c: crate::sys::CGContextRef); + fn CGContextRestoreGState(c: crate::sys::CGContextRef); + fn CGContextTranslateCTM(c: crate::sys::CGContextRef, tx: CGFloat, ty: CGFloat); + fn CGContextScaleCTM(c: crate::sys::CGContextRef, sx: CGFloat, sy: CGFloat); + fn CGContextRotateCTM(c: crate::sys::CGContextRef, angle: CGFloat); + fn CGContextGetCTM(c: crate::sys::CGContextRef) -> CGAffineTransform; + fn CGContextConcatCTM(c: crate::sys::CGContextRef, transform: CGAffineTransform); fn CGContextDrawLinearGradient( - c: ::sys::CGContextRef, - gradient: ::sys::CGGradientRef, + c: crate::sys::CGContextRef, + gradient: crate::sys::CGGradientRef, startPoint: CGPoint, endPoint: CGPoint, options: CGGradientDrawingOptions, ); fn CGContextDrawRadialGradient( - c: ::sys::CGContextRef, - gradient: ::sys::CGGradientRef, + c: crate::sys::CGContextRef, + gradient: crate::sys::CGGradientRef, startCenter: CGPoint, startRadius: CGFloat, endCenter: CGPoint, @@ -770,13 +781,13 @@ extern "C" { options: CGGradientDrawingOptions, ); - fn CGContextSetShadow(c: ::sys::CGContextRef, offset: CGSize, blur: CGFloat); + fn CGContextSetShadow(c: crate::sys::CGContextRef, offset: CGSize, blur: CGFloat); fn CGContextSetShadowWithColor( - c: ::sys::CGContextRef, + c: crate::sys::CGContextRef, offset: CGSize, blur: CGFloat, - color: ::sys::CGColorRef, + color: crate::sys::CGColorRef, ); - fn CGContextSetAlpha(c: ::sys::CGContextRef, alpha: CGFloat); + fn CGContextSetAlpha(c: crate::sys::CGContextRef, alpha: CGFloat); } diff --git a/core-graphics/src/data_provider.rs b/core-graphics/src/data_provider.rs index e43f9fbc5..6002659c3 100644 --- a/core-graphics/src/data_provider.rs +++ b/core-graphics/src/data_provider.rs @@ -40,7 +40,7 @@ pub type CGDataProviderGetBytesAtPositionCallback = foreign_type! { #[doc(hidden)] pub unsafe type CGDataProvider { - type CType = ::sys::CGDataProvider; + type CType = crate::sys::CGDataProvider; fn drop = |cs| CFRelease(cs as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -155,7 +155,7 @@ fn test_data_provider() { #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { - fn CGDataProviderCopyData(provider: ::sys::CGDataProviderRef) -> CFDataRef; + fn CGDataProviderCopyData(provider: crate::sys::CGDataProviderRef) -> CFDataRef; //fn CGDataProviderCreateDirect //fn CGDataProviderCreateSequential //fn CGDataProviderCreateWithCFData @@ -164,7 +164,7 @@ extern "C" { data: *const c_void, size: size_t, releaseData: CGDataProviderReleaseDataCallback, - ) -> ::sys::CGDataProviderRef; + ) -> crate::sys::CGDataProviderRef; //fn CGDataProviderCreateWithFilename(filename: *c_char) -> CGDataProviderRef; //fn CGDataProviderCreateWithURL fn CGDataProviderGetTypeID() -> CFTypeID; diff --git a/core-graphics/src/display.rs b/core-graphics/src/display.rs index 87db937aa..d2f450f2d 100644 --- a/core-graphics/src/display.rs +++ b/core-graphics/src/display.rs @@ -13,13 +13,13 @@ use libc; use std::ops::Deref; use std::ptr; -pub use base::{boolean_t, CGError}; -pub use geometry::{CGPoint, CGRect, CGSize}; +pub use crate::base::{boolean_t, CGError}; +pub use crate::geometry::{CGPoint, CGRect, CGSize}; +use crate::image::CGImage; use core_foundation::base::{CFRetain, TCFType}; use core_foundation::string::{CFString, CFStringRef}; use foreign_types::ForeignType; -use image::CGImage; pub type CGDirectDisplayID = u32; pub type CGWindowID = u32; @@ -118,7 +118,7 @@ pub struct CGDisplay { foreign_type! { #[doc(hidden)] pub unsafe type CGDisplayMode { - type CType = ::sys::CGDisplayMode; + type CType = crate::sys::CGDisplayMode; fn drop = CGDisplayModeRelease; fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -560,7 +560,7 @@ impl CGDisplayMode { let vec: Vec = modes .into_iter() .map(|value0| { - let x = *value0.deref() as *mut ::sys::CGDisplayMode; + let x = *value0.deref() as *mut crate::sys::CGDisplayMode; unsafe { CGDisplayMode::from_ptr(x) } }) .collect(); @@ -647,8 +647,8 @@ extern "C" { pub static kCGDisplayShowDuplicateLowResolutionModes: CFStringRef; - pub fn CGDisplayModeRetain(mode: ::sys::CGDisplayModeRef); - pub fn CGDisplayModeRelease(mode: ::sys::CGDisplayModeRef); + pub fn CGDisplayModeRetain(mode: crate::sys::CGDisplayModeRef); + pub fn CGDisplayModeRelease(mode: crate::sys::CGDisplayModeRef); pub fn CGMainDisplayID() -> CGDirectDisplayID; pub fn CGDisplayIsActive(display: CGDirectDisplayID) -> boolean_t; @@ -683,11 +683,11 @@ extern "C" { pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t; pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t; pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect; - pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> ::sys::CGImageRef; + pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> crate::sys::CGImageRef; pub fn CGDisplayCreateImageForRect( display: CGDirectDisplayID, rect: CGRect, - ) -> ::sys::CGImageRef; + ) -> crate::sys::CGImageRef; // Capturing and Releasing Displays pub fn CGDisplayCapture(display: CGDirectDisplayID) -> CGError; @@ -704,7 +704,7 @@ extern "C" { pub fn CGConfigureDisplayWithDisplayMode( config: CGDisplayConfigRef, display: CGDirectDisplayID, - mode: ::sys::CGDisplayModeRef, + mode: crate::sys::CGDisplayModeRef, options: CFDictionaryRef, ) -> CGError; pub fn CGConfigureDisplayMirrorOfDisplay( @@ -720,15 +720,15 @@ extern "C" { ) -> CGError; pub fn CGRestorePermanentDisplayConfiguration(); - pub fn CGDisplayCopyDisplayMode(display: CGDirectDisplayID) -> ::sys::CGDisplayModeRef; - pub fn CGDisplayModeGetHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t; - pub fn CGDisplayModeGetWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t; - pub fn CGDisplayModeGetPixelHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t; - pub fn CGDisplayModeGetPixelWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t; - pub fn CGDisplayModeGetRefreshRate(mode: ::sys::CGDisplayModeRef) -> libc::c_double; - pub fn CGDisplayModeGetIOFlags(mode: ::sys::CGDisplayModeRef) -> u32; - pub fn CGDisplayModeCopyPixelEncoding(mode: ::sys::CGDisplayModeRef) -> CFStringRef; - pub fn CGDisplayModeGetIODisplayModeID(mode: ::sys::CGDisplayModeRef) -> i32; + pub fn CGDisplayCopyDisplayMode(display: CGDirectDisplayID) -> crate::sys::CGDisplayModeRef; + pub fn CGDisplayModeGetHeight(mode: crate::sys::CGDisplayModeRef) -> libc::size_t; + pub fn CGDisplayModeGetWidth(mode: crate::sys::CGDisplayModeRef) -> libc::size_t; + pub fn CGDisplayModeGetPixelHeight(mode: crate::sys::CGDisplayModeRef) -> libc::size_t; + pub fn CGDisplayModeGetPixelWidth(mode: crate::sys::CGDisplayModeRef) -> libc::size_t; + pub fn CGDisplayModeGetRefreshRate(mode: crate::sys::CGDisplayModeRef) -> libc::c_double; + pub fn CGDisplayModeGetIOFlags(mode: crate::sys::CGDisplayModeRef) -> u32; + pub fn CGDisplayModeCopyPixelEncoding(mode: crate::sys::CGDisplayModeRef) -> CFStringRef; + pub fn CGDisplayModeGetIODisplayModeID(mode: crate::sys::CGDisplayModeRef) -> i32; pub fn CGDisplayCopyAllDisplayModes( display: CGDirectDisplayID, @@ -736,7 +736,7 @@ extern "C" { ) -> CFArrayRef; pub fn CGDisplaySetDisplayMode( display: CGDirectDisplayID, - mode: ::sys::CGDisplayModeRef, + mode: crate::sys::CGDisplayModeRef, options: CFDictionaryRef, ) -> CGError; @@ -783,10 +783,10 @@ extern "C" { listOptions: CGWindowListOption, windowId: CGWindowID, imageOptions: CGWindowImageOption, - ) -> ::sys::CGImageRef; + ) -> crate::sys::CGImageRef; pub fn CGWindowListCreateImageFromArray( screenBounds: CGRect, windowArray: CFArrayRef, imageOptions: CGWindowImageOption, - ) -> ::sys::CGImageRef; + ) -> crate::sys::CGImageRef; } diff --git a/core-graphics/src/event.rs b/core-graphics/src/event.rs index 3d23f25dc..730557668 100644 --- a/core-graphics/src/event.rs +++ b/core-graphics/src/event.rs @@ -1,11 +1,11 @@ #![allow(non_upper_case_globals)] +use crate::event_source::CGEventSource; +use crate::geometry::CGPoint; use core_foundation::{ base::{CFRelease, CFRetain, CFTypeID, TCFType}, mach_port::{CFMachPort, CFMachPortRef}, }; -use event_source::CGEventSource; use foreign_types::ForeignType; -use geometry::CGPoint; use libc::c_void; use std::mem::ManuallyDrop; @@ -419,16 +419,16 @@ pub type CGEventTapCallBackFn<'tap_life> = type CGEventTapCallBackInternal = unsafe extern "C" fn( proxy: CGEventTapProxy, etype: CGEventType, - event: ::sys::CGEventRef, + event: crate::sys::CGEventRef, user_info: *const c_void, -) -> ::sys::CGEventRef; +) -> crate::sys::CGEventRef; unsafe extern "C" fn cg_event_tap_callback_internal( _proxy: CGEventTapProxy, _etype: CGEventType, - _event: ::sys::CGEventRef, + _event: crate::sys::CGEventRef, _user_info: *const c_void, -) -> ::sys::CGEventRef { +) -> crate::sys::CGEventRef { let callback = _user_info as *mut CGEventTapCallBackFn; let event = CGEvent::from_ptr(_event); let new_event = (*callback)(_proxy, _etype, &event); @@ -517,7 +517,7 @@ impl<'tap_life> CGEventTap<'tap_life> { foreign_type! { #[doc(hidden)] pub unsafe type CGEvent { - type CType = ::sys::CGEvent; + type CType = crate::sys::CGEvent; fn drop = |p| CFRelease(p as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -680,7 +680,7 @@ extern "C" { /// Return a new event using the event source `source'. If `source' is NULL, /// the default source is used. - fn CGEventCreate(source: ::sys::CGEventSourceRef) -> ::sys::CGEventRef; + fn CGEventCreate(source: crate::sys::CGEventSourceRef) -> crate::sys::CGEventRef; /// Return a new keyboard event. /// @@ -693,10 +693,10 @@ extern "C" { /// the SHIFT key must be down, the 'z' key must go down, and then the SHIFT /// and 'z' key must be released: fn CGEventCreateKeyboardEvent( - source: ::sys::CGEventSourceRef, + source: crate::sys::CGEventSourceRef, keycode: CGKeyCode, keydown: bool, - ) -> ::sys::CGEventRef; + ) -> crate::sys::CGEventRef; /// Return a new mouse event. /// @@ -712,11 +712,11 @@ extern "C" { /// Mouse button 1 is the secondary mouse button (right). Mouse button 2 is /// the center button, and the remaining buttons are in USB device order. fn CGEventCreateMouseEvent( - source: ::sys::CGEventSourceRef, + source: crate::sys::CGEventSourceRef, mouseType: CGEventType, mouseCursorPosition: CGPoint, mouseButton: CGMouseButton, - ) -> ::sys::CGEventRef; + ) -> crate::sys::CGEventRef; /// A non-variadic variant version of CGEventCreateScrollWheelEvent. /// @@ -726,42 +726,42 @@ extern "C" { /// event before posting it to the event system. #[cfg(feature = "highsierra")] fn CGEventCreateScrollWheelEvent2( - source: ::sys::CGEventSourceRef, + source: crate::sys::CGEventSourceRef, units: CGScrollEventUnit, wheelCount: u32, wheel1: i32, wheel2: i32, wheel3: i32, - ) -> ::sys::CGEventRef; + ) -> crate::sys::CGEventRef; /// Post an event into the event stream at a specified location. /// /// This function posts the specified event immediately before any event taps /// instantiated for that location, and the event passes through any such /// taps. - fn CGEventPost(tapLocation: CGEventTapLocation, event: ::sys::CGEventRef); + fn CGEventPost(tapLocation: CGEventTapLocation, event: crate::sys::CGEventRef); - fn CGEventTapPostEvent(tapProxy: CGEventTapProxy, event: ::sys::CGEventRef); + fn CGEventTapPostEvent(tapProxy: CGEventTapProxy, event: crate::sys::CGEventRef); #[cfg(feature = "elcapitan")] /// Post an event to a specified process ID - fn CGEventPostToPid(pid: libc::pid_t, event: ::sys::CGEventRef); + fn CGEventPostToPid(pid: libc::pid_t, event: crate::sys::CGEventRef); /// Set the event flags of an event. - fn CGEventSetFlags(event: ::sys::CGEventRef, flags: CGEventFlags); + fn CGEventSetFlags(event: crate::sys::CGEventRef, flags: CGEventFlags); /// Return the event flags of an event. - fn CGEventGetFlags(event: ::sys::CGEventRef) -> CGEventFlags; + fn CGEventGetFlags(event: crate::sys::CGEventRef) -> CGEventFlags; /// Return the location of an event in global display coordinates. - /// CGPointZero is returned if event is not a valid ::sys::CGEventRef. - fn CGEventGetLocation(event: ::sys::CGEventRef) -> CGPoint; + /// CGPointZero is returned if event is not a valid crate::sys::CGEventRef. + fn CGEventGetLocation(event: crate::sys::CGEventRef) -> CGPoint; /// Set the event type of an event. - fn CGEventSetType(event: ::sys::CGEventRef, eventType: CGEventType); + fn CGEventSetType(event: crate::sys::CGEventRef, eventType: CGEventType); /// Return the event type of an event (left mouse down, for example). - fn CGEventGetType(event: ::sys::CGEventRef) -> CGEventType; + fn CGEventGetType(event: crate::sys::CGEventRef) -> CGEventType; /// Set the Unicode string associated with a keyboard event. /// @@ -772,13 +772,13 @@ extern "C" { /// keyboard event and do their own translation based on the virtual /// keycode and perceived event state. fn CGEventKeyboardSetUnicodeString( - event: ::sys::CGEventRef, + event: crate::sys::CGEventRef, length: libc::c_ulong, string: *const u16, ); /// Return the integer value of a field in an event. - fn CGEventGetIntegerValueField(event: ::sys::CGEventRef, field: CGEventField) -> i64; + fn CGEventGetIntegerValueField(event: crate::sys::CGEventRef, field: CGEventField) -> i64; /// Set the integer value of a field in an event. /// @@ -790,14 +790,14 @@ extern "C" { /// function and specify the field `kCGMouseEventSubtype' with a value of /// `kCGEventMouseSubtypeTabletPoint' or /// `kCGEventMouseSubtypeTabletProximity' before setting other parameters. - fn CGEventSetIntegerValueField(event: ::sys::CGEventRef, field: CGEventField, value: i64); + fn CGEventSetIntegerValueField(event: crate::sys::CGEventRef, field: CGEventField, value: i64); /// Return the floating-point value of a field in an event. /// /// In cases where the field value is represented within the event by a fixed /// point number or an integer, the result is scaled to the appropriate range /// as part of creating the floating-point representation. - fn CGEventGetDoubleValueField(event: ::sys::CGEventRef, field: CGEventField) -> f64; + fn CGEventGetDoubleValueField(event: crate::sys::CGEventRef, field: CGEventField) -> f64; /// Set the floating-point value of a field in an event. /// @@ -808,7 +808,7 @@ extern "C" { /// In cases where the field’s value is represented within the event by a /// fixed point number or integer, the value parameter is scaled as needed /// and converted to the appropriate type. - fn CGEventSetDoubleValueField(event: ::sys::CGEventRef, field: CGEventField, value: f64); + fn CGEventSetDoubleValueField(event: crate::sys::CGEventRef, field: CGEventField, value: f64); // ::sys::CGEventTapRef is actually an CFMachPortRef fn CGEventTapCreate( diff --git a/core-graphics/src/event_source.rs b/core-graphics/src/event_source.rs index 43522c666..7ac2c5a23 100644 --- a/core-graphics/src/event_source.rs +++ b/core-graphics/src/event_source.rs @@ -13,7 +13,7 @@ pub enum CGEventSourceStateID { foreign_type! { #[doc(hidden)] pub unsafe type CGEventSource { - type CType = ::sys::CGEventSource; + type CType = crate::sys::CGEventSource; fn drop = |p| CFRelease(p as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -42,5 +42,5 @@ extern "C" { fn CGEventSourceGetTypeID() -> CFTypeID; /// Return a Quartz event source created with a specified source state. - fn CGEventSourceCreate(stateID: CGEventSourceStateID) -> ::sys::CGEventSourceRef; + fn CGEventSourceCreate(stateID: CGEventSourceStateID) -> crate::sys::CGEventSourceRef; } diff --git a/core-graphics/src/font.rs b/core-graphics/src/font.rs index e00626a1f..48d53dd31 100644 --- a/core-graphics/src/font.rs +++ b/core-graphics/src/font.rs @@ -7,14 +7,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::data_provider::CGDataProvider; +use crate::geometry::CGRect; use core_foundation::array::{CFArray, CFArrayRef}; use core_foundation::base::{CFRelease, CFRetain, CFType, CFTypeID, TCFType}; use core_foundation::data::{CFData, CFDataRef}; use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; use core_foundation::number::CFNumber; use core_foundation::string::{CFString, CFStringRef}; -use data_provider::CGDataProvider; -use geometry::CGRect; use std::ptr::NonNull; use foreign_types::ForeignType; @@ -26,7 +26,7 @@ pub use core_graphics_types::base::CGGlyph; foreign_type! { #[doc(hidden)] pub unsafe type CGFont: Send + Sync { - type CType = ::sys::CGFont; + type CType = crate::sys::CGFont; fn drop = |p| CFRelease(p as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -141,15 +141,17 @@ impl CGFont { #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { // TODO: basically nothing has bindings (even commented-out) besides what we use. - fn CGFontCreateWithDataProvider(provider: ::sys::CGDataProviderRef) -> ::sys::CGFontRef; - fn CGFontCreateWithFontName(name: CFStringRef) -> ::sys::CGFontRef; + fn CGFontCreateWithDataProvider( + provider: crate::sys::CGDataProviderRef, + ) -> crate::sys::CGFontRef; + fn CGFontCreateWithFontName(name: CFStringRef) -> crate::sys::CGFontRef; fn CGFontCreateCopyWithVariations( - font: ::sys::CGFontRef, + font: crate::sys::CGFontRef, vars: CFDictionaryRef, - ) -> ::sys::CGFontRef; + ) -> crate::sys::CGFontRef; fn CGFontGetTypeID() -> CFTypeID; - fn CGFontCopyPostScriptName(font: ::sys::CGFontRef) -> CFStringRef; + fn CGFontCopyPostScriptName(font: crate::sys::CGFontRef) -> CFStringRef; // These do the same thing as CFRetain/CFRelease, except // gracefully handle a NULL argument. We don't use them. @@ -157,21 +159,21 @@ extern "C" { //fn CGFontRelease(font: ::sys::CGFontRef); fn CGFontGetGlyphBBoxes( - font: ::sys::CGFontRef, + font: crate::sys::CGFontRef, glyphs: *const CGGlyph, count: size_t, bboxes: *mut CGRect, ) -> bool; fn CGFontGetGlyphAdvances( - font: ::sys::CGFontRef, + font: crate::sys::CGFontRef, glyphs: *const CGGlyph, count: size_t, advances: *mut c_int, ) -> bool; - fn CGFontGetUnitsPerEm(font: ::sys::CGFontRef) -> c_int; + fn CGFontGetUnitsPerEm(font: crate::sys::CGFontRef) -> c_int; - fn CGFontCopyTableTags(font: ::sys::CGFontRef) -> CFArrayRef; - fn CGFontCopyTableForTag(font: ::sys::CGFontRef, tag: u32) -> CFDataRef; - fn CGFontCopyVariations(font: ::sys::CGFontRef) -> CFDictionaryRef; - fn CGFontCopyVariationAxes(font: ::sys::CGFontRef) -> CFArrayRef; + fn CGFontCopyTableTags(font: crate::sys::CGFontRef) -> CFArrayRef; + fn CGFontCopyTableForTag(font: crate::sys::CGFontRef, tag: u32) -> CFDataRef; + fn CGFontCopyVariations(font: crate::sys::CGFontRef) -> CFDictionaryRef; + fn CGFontCopyVariationAxes(font: crate::sys::CGFontRef) -> CFArrayRef; } diff --git a/core-graphics/src/gradient.rs b/core-graphics/src/gradient.rs index 5c241df05..b3bdcb645 100644 --- a/core-graphics/src/gradient.rs +++ b/core-graphics/src/gradient.rs @@ -9,9 +9,9 @@ #![allow(non_upper_case_globals)] -use base::CGFloat; -use color::CGColor; -use color_space::CGColorSpace; +use crate::base::CGFloat; +use crate::color::CGColor; +use crate::color_space::CGColorSpace; use core_foundation::array::{CFArray, CFArrayRef}; use core_foundation::base::{CFRelease, CFRetain, TCFType}; @@ -30,7 +30,7 @@ bitflags! { foreign_type! { #[doc(hidden)] pub unsafe type CGGradient { - type CType = ::sys::CGGradient; + type CType = crate::sys::CGGradient; fn drop = |p| CFRelease(p as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -75,14 +75,14 @@ impl CGGradient { #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { fn CGGradientCreateWithColorComponents( - color_space: ::sys::CGColorSpaceRef, + color_space: crate::sys::CGColorSpaceRef, components: *const CGFloat, locations: *const CGFloat, count: size_t, - ) -> ::sys::CGGradientRef; + ) -> crate::sys::CGGradientRef; fn CGGradientCreateWithColors( - color_space: ::sys::CGColorSpaceRef, + color_space: crate::sys::CGColorSpaceRef, colors: CFArrayRef, locations: *const CGFloat, - ) -> ::sys::CGGradientRef; + ) -> crate::sys::CGGradientRef; } diff --git a/core-graphics/src/image.rs b/core-graphics/src/image.rs index 0433065bd..e684ffb2a 100644 --- a/core-graphics/src/image.rs +++ b/core-graphics/src/image.rs @@ -1,12 +1,12 @@ use std::ptr; -use base::CGFloat; -use color_space::CGColorSpace; +use crate::base::CGFloat; +use crate::color_space::CGColorSpace; +use crate::data_provider::{CGDataProvider, CGDataProviderRef}; +use crate::geometry::CGRect; use core_foundation::base::{CFRetain, CFTypeID}; use core_foundation::data::CFData; -use data_provider::{CGDataProvider, CGDataProviderRef}; use foreign_types::{ForeignType, ForeignTypeRef}; -use geometry::CGRect; use libc::size_t; #[repr(C)] @@ -33,7 +33,7 @@ pub enum CGImageByteOrderInfo { foreign_type! { #[doc(hidden)] pub unsafe type CGImage { - type CType = ::sys::CGImage; + type CType = crate::sys::CGImage; fn drop = CGImageRelease; fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -128,28 +128,31 @@ impl CGImageRef { #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { fn CGImageGetTypeID() -> CFTypeID; - fn CGImageGetWidth(image: ::sys::CGImageRef) -> size_t; - fn CGImageGetHeight(image: ::sys::CGImageRef) -> size_t; - fn CGImageGetBitsPerComponent(image: ::sys::CGImageRef) -> size_t; - fn CGImageGetBitsPerPixel(image: ::sys::CGImageRef) -> size_t; - fn CGImageGetBytesPerRow(image: ::sys::CGImageRef) -> size_t; - fn CGImageGetColorSpace(image: ::sys::CGImageRef) -> ::sys::CGColorSpaceRef; - fn CGImageGetDataProvider(image: ::sys::CGImageRef) -> ::sys::CGDataProviderRef; - fn CGImageRelease(image: ::sys::CGImageRef); + fn CGImageGetWidth(image: crate::sys::CGImageRef) -> size_t; + fn CGImageGetHeight(image: crate::sys::CGImageRef) -> size_t; + fn CGImageGetBitsPerComponent(image: crate::sys::CGImageRef) -> size_t; + fn CGImageGetBitsPerPixel(image: crate::sys::CGImageRef) -> size_t; + fn CGImageGetBytesPerRow(image: crate::sys::CGImageRef) -> size_t; + fn CGImageGetColorSpace(image: crate::sys::CGImageRef) -> crate::sys::CGColorSpaceRef; + fn CGImageGetDataProvider(image: crate::sys::CGImageRef) -> crate::sys::CGDataProviderRef; + fn CGImageRelease(image: crate::sys::CGImageRef); fn CGImageCreate( width: size_t, height: size_t, bitsPerComponent: size_t, bitsPerPixel: size_t, bytesPerRow: size_t, - space: ::sys::CGColorSpaceRef, + space: crate::sys::CGColorSpaceRef, bitmapInfo: u32, - provider: ::sys::CGDataProviderRef, + provider: crate::sys::CGDataProviderRef, decode: *const CGFloat, shouldInterpolate: bool, intent: u32, - ) -> ::sys::CGImageRef; - fn CGImageCreateWithImageInRect(image: ::sys::CGImageRef, rect: CGRect) -> ::sys::CGImageRef; + ) -> crate::sys::CGImageRef; + fn CGImageCreateWithImageInRect( + image: crate::sys::CGImageRef, + rect: CGRect, + ) -> crate::sys::CGImageRef; //fn CGImageGetAlphaInfo(image: ::sys::CGImageRef) -> CGImageAlphaInfo; //fn CGImageCreateCopyWithColorSpace(image: ::sys::CGImageRef, space: ::sys::CGColorSpaceRef) -> ::sys::CGImageRef diff --git a/core-graphics/src/path.rs b/core-graphics/src/path.rs index cf612e164..78c2653ba 100644 --- a/core-graphics/src/path.rs +++ b/core-graphics/src/path.rs @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub use sys::CGPathRef as SysCGPathRef; +pub use crate::sys::CGPathRef as SysCGPathRef; +use crate::geometry::{CGAffineTransform, CGPoint, CGRect}; use core_foundation::base::{CFRelease, CFRetain, CFTypeID}; use foreign_types::ForeignType; -use geometry::{CGAffineTransform, CGPoint, CGRect}; use libc::c_void; use std::fmt::{self, Debug, Formatter}; use std::marker::PhantomData; @@ -22,7 +22,7 @@ use std::slice; foreign_type! { #[doc(hidden)] pub unsafe type CGPath { - type CType = ::sys::CGPath; + type CType = crate::sys::CGPath; fn drop = |p| CFRelease(p as *mut _); fn clone = |p| CFRetain(p as *const _) as *mut _; } @@ -127,7 +127,10 @@ type CGPathApplierFunction = unsafe extern "C" fn(info: *mut c_void, element: *c #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] extern "C" { - fn CGPathCreateWithRect(rect: CGRect, transform: *const CGAffineTransform) -> ::sys::CGPathRef; - fn CGPathApply(path: ::sys::CGPathRef, info: *mut c_void, function: CGPathApplierFunction); + fn CGPathCreateWithRect( + rect: CGRect, + transform: *const CGAffineTransform, + ) -> crate::sys::CGPathRef; + fn CGPathApply(path: crate::sys::CGPathRef, info: *mut c_void, function: CGPathApplierFunction); fn CGPathGetTypeID() -> CFTypeID; } diff --git a/core-graphics/src/private.rs b/core-graphics/src/private.rs index 6da3d48e3..67c8894c8 100644 --- a/core-graphics/src/private.rs +++ b/core-graphics/src/private.rs @@ -11,7 +11,7 @@ //! //! These are liable to change at any time. Use with caution! -use geometry::CGRect; +use crate::geometry::CGRect; use libc::{c_int, c_uint}; use std::ptr; @@ -86,7 +86,7 @@ impl CGSSurface { } mod ffi { - use geometry::CGRect; + use crate::geometry::CGRect; use libc::{c_int, c_uint}; // This is an enum so that we can't easily make instances of this opaque type. diff --git a/core-graphics/src/window.rs b/core-graphics/src/window.rs index 866ebd27f..7ae93f32d 100644 --- a/core-graphics/src/window.rs +++ b/core-graphics/src/window.rs @@ -15,9 +15,9 @@ use core_foundation::dictionary::CFDictionary; use core_foundation::string::{CFString, CFStringRef}; use foreign_types::ForeignType; -use geometry::CGRect; -use image::CGImage; -use sys; +use crate::geometry::CGRect; +use crate::image::CGImage; +use crate::sys; pub type CGWindowID = u32; diff --git a/core-text/Cargo.toml b/core-text/Cargo.toml index 320db38d9..e8715b487 100644 --- a/core-text/Cargo.toml +++ b/core-text/Cargo.toml @@ -5,6 +5,7 @@ authors = ["The Servo Project Developers"] description = "Bindings to the Core Text framework." license = "MIT OR Apache-2.0" repository = "https://github.com/servo/core-foundation-rs" +edition = "2018" [package.metadata.docs.rs] all-features = true diff --git a/core-text/src/font.rs b/core-text/src/font.rs index a39652d31..f4379f3b0 100644 --- a/core-text/src/font.rs +++ b/core-text/src/font.rs @@ -9,10 +9,12 @@ #![allow(non_upper_case_globals)] -use font_descriptor; -use font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; -use font_descriptor::{CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors}; -use font_manager::create_font_descriptor; +use crate::font_descriptor; +use crate::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; +use crate::font_descriptor::{ + CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors, +}; +use crate::font_manager::create_font_descriptor; use core_foundation::array::{CFArray, CFArrayRef}; use core_foundation::base::{CFIndex, CFOptionFlags, CFType, CFTypeID, CFTypeRef, TCFType}; diff --git a/core-text/src/font_collection.rs b/core-text/src/font_collection.rs index bf5822249..5745721c6 100644 --- a/core-text/src/font_collection.rs +++ b/core-text/src/font_collection.rs @@ -7,9 +7,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use font_descriptor; -use font_descriptor::{CTFontDescriptor, CTFontDescriptorCreateMatchingFontDescriptors}; -use font_manager::{ +use crate::font_descriptor; +use crate::font_descriptor::{CTFontDescriptor, CTFontDescriptorCreateMatchingFontDescriptors}; +use crate::font_manager::{ CTFontManagerCopyAvailableFontFamilyNames, CTFontManagerCopyAvailablePostScriptNames, }; @@ -78,7 +78,7 @@ pub fn create_for_all_families() -> CTFontCollection { } pub fn create_for_family(family: &str) -> Option { - use font_descriptor::kCTFontFamilyNameAttribute; + use crate::font_descriptor::kCTFontFamilyNameAttribute; unsafe { let family_attr = CFString::wrap_under_get_rule(kCTFontFamilyNameAttribute); diff --git a/core-text/src/line.rs b/core-text/src/line.rs index db429796a..09d34fd35 100644 --- a/core-text/src/line.rs +++ b/core-text/src/line.rs @@ -7,6 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::run::CTRun; use core_foundation::array::{CFArray, CFArrayRef}; use core_foundation::attributed_string::CFAttributedStringRef; use core_foundation::base::{CFIndex, CFRange, CFTypeID, TCFType}; @@ -14,7 +15,6 @@ use core_graphics::base::CGFloat; use core_graphics::context::CGContext; use core_graphics::geometry::{CGPoint, CGRect}; use foreign_types::ForeignType; -use run::CTRun; use std::os::raw::c_void; #[repr(C)] diff --git a/core-text/src/run.rs b/core-text/src/run.rs index 3f1c76a8b..e03065a1f 100644 --- a/core-text/src/run.rs +++ b/core-text/src/run.rs @@ -104,10 +104,10 @@ impl CTRun { #[test] fn create_runs() { + use crate::font; + use crate::line::*; + use crate::string_attributes::*; use core_foundation::attributed_string::CFMutableAttributedString; - use font; - use line::*; - use string_attributes::*; let mut string = CFMutableAttributedString::new(); string.replace_str(&CFString::new("Food"), CFRange::init(0, 0)); let len = string.char_len(); diff --git a/io-surface/Cargo.toml b/io-surface/Cargo.toml index f422e2547..2bd378bbc 100644 --- a/io-surface/Cargo.toml +++ b/io-surface/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.15.1" authors = ["The Servo Project Developers"] license = "MIT OR Apache-2.0" +edition = "2018" [package.metadata.docs.rs] default-target = "x86_64-apple-darwin"