Skip to content

Commit ce52ad2

Browse files
committed
Prepare for making the crate no_std
1 parent 56a1aa3 commit ce52ad2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ keywords = ["window", "metal", "graphics"]
1111
categories = ["game-engines", "graphics"]
1212
exclude = [".github/*"]
1313

14+
[features]
15+
default = ["std"]
16+
std = ["alloc"]
17+
alloc = []
18+
1419
[target.'cfg(target_vendor = "apple")'.dependencies]
1520
objc2 = "0.5.2"
1621
objc2-foundation = { version = "0.2.2", features = [

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
//!
9898
//! Option 3 seems like the most robust solution, so this is what this crate does.
9999
100+
#![no_std]
100101
#![cfg(target_vendor = "apple")]
101102
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc)))]
102103
#![deny(unsafe_op_in_unsafe_fn)]
@@ -113,6 +114,12 @@ use objc2::{msg_send_id, ClassType};
113114
use objc2_foundation::{MainThreadMarker, NSObject, NSObjectProtocol};
114115
use objc2_quartz_core::{CALayer, CAMetalLayer};
115116

117+
#[cfg(not(feature = "alloc"))]
118+
compile_error!("The `alloc` feature must currently be enabled.");
119+
120+
#[cfg(not(feature = "std"))]
121+
compile_error!("The `std` feature must currently be enabled.");
122+
116123
/// A wrapper around [`CAMetalLayer`].
117124
#[doc(alias = "CAMetalLayer")]
118125
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)