Skip to content

Commit 5154073

Browse files
committed
Prepare for making the crate no_std
1 parent 10f5284 commit 5154073

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
@@ -124,6 +124,7 @@
124124
//! do not modify common `CALayer` properties of the layer that `raw-window-metal` creates, since
125125
//! they may just end up being overwritten (see also "Semantics" above).
126126
127+
#![no_std]
127128
#![cfg(target_vendor = "apple")]
128129
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc)))]
129130
#![deny(unsafe_op_in_unsafe_fn)]
@@ -142,6 +143,12 @@ use objc2::{msg_send_id, ClassType};
142143
use objc2_foundation::{MainThreadMarker, NSObject, NSObjectProtocol};
143144
use objc2_quartz_core::{CALayer, CAMetalLayer};
144145

146+
#[cfg(not(feature = "alloc"))]
147+
compile_error!("The `alloc` feature must currently be enabled.");
148+
149+
#[cfg(not(feature = "std"))]
150+
compile_error!("The `std` feature must currently be enabled.");
151+
145152
/// A wrapper around [`CAMetalLayer`].
146153
#[doc(alias = "CAMetalLayer")]
147154
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)