Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #121 from a-isaiahharvey/stable-support
Browse files Browse the repository at this point in the history
Add support for stable Rust
  • Loading branch information
martial-plains committed Nov 9, 2022
2 parents 96a04b2 + 724e6c3 commit f060998
Show file tree
Hide file tree
Showing 147 changed files with 338 additions and 307 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
components: clippy
override: true

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
- uses: actions/checkout@v3
- name: Build
run: |
rustup override set nightly
cargo build --verbose
- name: Run tests
run: |
rustup override set nightly
cargo test --verbose
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-macios"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["Allister Isaiah Harvey <a.i.harvey@icloud.com>"]
description = "Apple Frameworks for Rust"
Expand All @@ -11,7 +11,7 @@ repository = "https://github.com/a-isaiahharvey/rust-macios"
documentation = "https://docs.rs/crate/rust-macios/"

[package.metadata.docs.rs]
default-target = "x86_64-apple-darwin"
default-target = "aarch64-apple-darwin"
targets = [
# MacOS
"x86_64-apple-darwin",
Expand Down Expand Up @@ -46,6 +46,8 @@ block = "0.1.6"
lazy_static = "1.4.0"
bitflags = "1.3.2"

va_list = "0.1.4"

[dev-dependencies]
test-case = "2.1.0"

Expand Down
3 changes: 2 additions & 1 deletion examples/appkit/hello_world_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use rust_macios::{
INSViewController, INSWindow, NSApplication, NSApplicationActivationPolicy,
NSLayoutConstraint, NSTextField, NSView, NSWindow, PNSApplicationDelegate,
},
foundation::{macros::nsarray, NSPoint, NSRect, NSSize, NSString},
foundation::{NSPoint, NSRect, NSSize, NSString},
nsarray,
objective_c_runtime::{
class_init, id, msg_send, nil, objc_sel, register_class, runtime::Object, sel, sel_impl,
traits::PNSObject, Id, ShareId,
Expand Down
3 changes: 2 additions & 1 deletion examples/appkit/popover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use rust_macios::{
NSPopover, NSPopoverBehavior, NSStatusBar, NSStatusItem, NSTextField, NSView,
PNSApplicationDelegate,
},
foundation::{macros::nsarray, NSPoint, NSRect, NSRectEdge, NSSize, NSString},
foundation::{NSPoint, NSRect, NSRectEdge, NSSize, NSString},
nsarray,
objective_c_runtime::{
class_init, id, msg_send, nil, objc_sel, register_class, runtime::Object, sel, sel_impl,
traits::PNSObject, Id, ShareId,
Expand Down
3 changes: 2 additions & 1 deletion examples/contacts/create_contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use rust_macios::{
CNContactStore, CNLabelHome, CNLabelWork, CNLabeledValue, CNMutableContact,
CNMutablePostalAddress, CNSaveRequest,
},
foundation::{macros::nsarray, NSError, NSString},
foundation::{NSError, NSString},
nsarray,
objective_c_runtime::traits::PNSObject,
};

Expand Down
3 changes: 2 additions & 1 deletion examples/natural_language/identifying_parts_of_speech.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::ops::Range;

use rust_macios::{
foundation::{macros::nsarray, NSRange},
foundation::NSRange,
natural_language::{
nl_tag_scheme::LexicalClass, NLTag, NLTagger, NLTaggerOptions, NLTokenUnit,
},
nsarray,
objective_c_runtime::{nil, traits::PNSObject},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use std::ops::Range;

use rust_macios::{
foundation::{macros::nsarray, NSRange},
foundation::NSRange,
natural_language::{
nl_tag::{OrganizationName, PersonalName, PlaceName},
nl_tag_scheme::NameType,
NLTag, NLTagger, NLTaggerOptions, NLTokenUnit,
},
nsarray,
objective_c_runtime::{nil, traits::PNSObject},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use rust_macios::{
foundation::macros::{nsarray, nsdictionary},
natural_language::{
English, French, Italian, NLLanguageRecognizer, Portuguese, Spanish, Swedish,
},
nsarray, nsdictionary,
objective_c_runtime::traits::PNSObject,
};

Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_appearance.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::objective_c_runtime::macros::object;
use crate::object;

object! {
/// An object that manages standard appearance attributes for UI elements in an app.
Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_button.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use objc::{msg_send, sel, sel_impl};

pub(crate) use crate::objective_c_runtime::macros::{interface_impl, object};
use crate::{foundation::NSString, objective_c_runtime::traits::FromId};
pub(crate) use crate::{object, objective_c_runtime::macros::interface_impl};

use super::{INSControl, INSResponder, INSView, NSImage};

Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_color.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::object;
use crate::object;

object! {
/// An object that stores color data and sometimes opacity (alpha value).
Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_color_space.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::object;
use crate::object;

object! {
/// An object that represents a custom color space.
Expand Down
4 changes: 2 additions & 2 deletions src/appkit/ns_control.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use objc::{msg_send, runtime::Sel, sel, sel_impl};

use crate::appkit::INSView;
use crate::{appkit::INSView, object};

use super::{interface_impl, object, INSResponder};
use super::{interface_impl, INSResponder};

object! {
/// A specialized view, such as a button or text field, that notifies your app of relevant events using the target-action design pattern.
Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_dock_tile.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::object;
use crate::object;

object! {
/// The visual representation of your app’s miniaturized windows and app icon as they appear in the Dock.
Expand Down
4 changes: 2 additions & 2 deletions src/appkit/ns_image.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use objc::{msg_send, sel, sel_impl};

use super::{interface_impl, object, NSImageName};
use super::{interface_impl, NSImageName};

use crate::objective_c_runtime::traits::PNSObject;
use crate::{object, objective_c_runtime::traits::PNSObject};

object! {
/// A high-level interface for manipulating image data.
Expand Down
9 changes: 6 additions & 3 deletions src/appkit/ns_layout_anchor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use objc::{msg_send, sel, sel_impl};

use crate::objective_c_runtime::{
macros::{interface_impl, object},
traits::{FromId, PNSObject},
use crate::{
object,
objective_c_runtime::{
macros::interface_impl,
traits::{FromId, PNSObject},
},
};

use super::NSLayoutConstraint;
Expand Down
6 changes: 2 additions & 4 deletions src/appkit/ns_layout_constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use objc::{msg_send, sel, sel_impl};

use crate::{
foundation::NSArray,
objective_c_runtime::{
macros::{interface_impl, object},
traits::PNSObject,
},
object,
objective_c_runtime::{macros::interface_impl, traits::PNSObject},
};

object! {
Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_layout_x_axis_anchor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::objective_c_runtime::macros::{interface_impl, object};
use crate::{object, objective_c_runtime::macros::{interface_impl}};

use super::INSLayoutAnchor;

Expand Down
2 changes: 1 addition & 1 deletion src/appkit/ns_layout_y_axis_anchor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::objective_c_runtime::macros::{interface_impl, object};
use crate::{object, objective_c_runtime::macros::{interface_impl}};

use super::INSLayoutAnchor;

Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ use objc::{class, msg_send, runtime::Sel, sel, sel_impl};
use crate::{
core_graphics::CGFloat,
foundation::{Int, NSString},
object,
objective_c_runtime::traits::{FromId, PNSObject},
utils::to_bool,
};

use super::{interface_impl, object, NSMenuItem};
use super::{interface_impl, NSMenuItem};

object! {
/// An object that manages an app’s menus.
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_menu_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ use objc::{msg_send, runtime::Sel, sel, sel_impl};

use crate::{
foundation::NSString,
object,
objective_c_runtime::{
id, nil,
traits::{FromId, PNSObject},
},
utils::to_bool,
};

use super::{interface_impl, object, NSMenu};
use super::{interface_impl, NSMenu};

object! {
/// A command item in an app menu.
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_nib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ use objc::{msg_send, sel, sel_impl};

use crate::{
foundation::{NSArray, NSBundle, NSData, NSDictionary, NSString, NSURL},
object,
objective_c_runtime::{
id, nil,
traits::{FromId, PNSObject},
},
utils::to_bool,
};

use super::{interface_impl, object};
use super::interface_impl;

pub type NSNibName = NSString;

Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_pasteboard.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use objc::{msg_send, runtime::Class, sel, sel_impl};

use super::{interface_impl, ns_pasteboard_item::NSPasteboardItem, object};
use super::{interface_impl, ns_pasteboard_item::NSPasteboardItem};

use crate::{
foundation::{Int, NSArray, NSData, NSDictionary, NSFileWrapper, NSString, UInt},
object,
objective_c_runtime::{
id,
traits::{FromId, PNSObject},
Expand Down
4 changes: 2 additions & 2 deletions src/appkit/ns_pasteboard_item.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{interface_impl, object};
use super::interface_impl;

use crate::objective_c_runtime::traits::PNSObject;
use crate::{object, objective_c_runtime::traits::PNSObject};

object! {
unsafe pub struct NSPasteboardItem;
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_popover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use objc::{class, msg_send, sel, sel_impl};
use crate::{
core_graphics::CGRectEdge,
foundation::{NSCoder, NSRect, NSSize},
object,
objective_c_runtime::{id, traits::FromId},
utils::to_bool,
};

use super::{
interface_impl, ns_appearance::NSAppearance, object, INSResponder, INSView, INSViewController,
interface_impl, ns_appearance::NSAppearance, INSResponder, INSView, INSViewController,
NSPopoverBehavior, NSViewController,
};

Expand Down
4 changes: 2 additions & 2 deletions src/appkit/ns_responder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::objective_c_runtime::traits::PNSObject;
use crate::{object, objective_c_runtime::traits::PNSObject};

use super::{interface_impl, object};
use super::interface_impl;

object! {
/// An abstract class that forms the basis of event and command processing
Expand Down
7 changes: 5 additions & 2 deletions src/appkit/ns_running_application.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use objc::{msg_send, sel, sel_impl};

use crate::objective_c_runtime::traits::{FromId, PNSObject};
use crate::{
object,
objective_c_runtime::traits::{FromId, PNSObject},
};

use super::{interface_impl, object, NSApplicationActivationOptions};
use super::{interface_impl, NSApplicationActivationOptions};

object! {
/// An object that can manipulate and provide information for a single instance of an app.
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
Int, NSAlignmentOptions, NSDictionary, NSEdgeInsets, NSNotificationName, NSRect, NSString,
NSTimeInterval,
},
object,
objective_c_runtime::{
id,
traits::{FromId, PNSObject},
Expand All @@ -16,7 +17,7 @@ use crate::{
/// These constants are the keys for device description dictionaries.
pub type NSDeviceDescriptionKey = NSString;

use super::{interface_impl, object, NSColorSpace, NSWindowDepth};
use super::{interface_impl, NSColorSpace, NSWindowDepth};

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
#[repr(u64)]
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_status_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use objc::{msg_send, sel, sel_impl};

use crate::{
core_graphics::CGFloat,
object,
objective_c_runtime::traits::{FromId, PNSObject},
};

use super::{interface_impl, object, NSStatusItem};
use super::{interface_impl, NSStatusItem};

object! {
/// An individual element displayed in the system menu bar.
Expand Down
4 changes: 2 additions & 2 deletions src/appkit/ns_status_bar_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use objc::{msg_send, sel, sel_impl};

use crate::{objective_c_runtime::traits::PNSObject, utils::to_bool};
use crate::{object, objective_c_runtime::traits::PNSObject, utils::to_bool};

use super::{interface_impl, object, ActionHandler, INSButton, INSControl, INSResponder, INSView};
use super::{interface_impl, ActionHandler, INSButton, INSControl, INSResponder, INSView};

object! {
/// The appearance and behavior of an item in the systemwide menu bar.
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_status_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ use objc::{msg_send, sel, sel_impl};

use crate::{
core_graphics::CGFloat,
object,
objective_c_runtime::{
nil,
traits::{FromId, PNSObject},
},
utils::to_bool,
};

use super::{interface_impl, object, NSMenu, NSStatusBar, NSStatusBarButton, NSStatusItemBehavior};
use super::{interface_impl, NSMenu, NSStatusBar, NSStatusBarButton, NSStatusItemBehavior};

object! {
/// An individual element displayed in the system menu bar.
Expand Down
3 changes: 2 additions & 1 deletion src/appkit/ns_storyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ use objc::{msg_send, sel, sel_impl};

use crate::{
foundation::NSBundle,
object,
objective_c_runtime::{
id, nil,
traits::{FromId, PNSObject},
},
};

use super::{object, NSStoryboardName};
use super::NSStoryboardName;

object! {
/// An encapsulation of the design-time view controller and window controller graph represented in an Interface Builder storyboard resource file.
Expand Down
Loading

0 comments on commit f060998

Please sign in to comment.