Skip to content

Commit 2fa0d3f

Browse files
authored
feat!: Make the core crate no-std (#468)
1 parent c1bd2d6 commit 2fa0d3f

File tree

9 files changed

+10
-21
lines changed

9 files changed

+10
-21
lines changed

common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ features = ["schemars", "serde"]
1818
enumn = { version = "0.1.6", optional = true }
1919
pyo3 = { version = "0.20", optional = true }
2020
schemars = { version = "0.8.7", optional = true }
21-
serde = { version = "1.0", features = ["derive"], optional = true }
21+
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true }
2222

2323
[features]
2424
enumn = ["dep:enumn"]

common/src/geometry.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// the LICENSE-APACHE file) or the MIT license (found in
1010
// the LICENSE-MIT file), at your option.
1111

12-
use std::{
12+
use core::{
1313
fmt,
1414
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},
1515
};
@@ -67,20 +67,6 @@ impl Affine {
6767
Affine([s_x, 0.0, 0.0, s_y, 0.0, 0.0])
6868
}
6969

70-
/// An affine transform representing rotation.
71-
///
72-
/// The convention for rotation is that a positive angle rotates a
73-
/// positive X direction into positive Y. Thus, in a Y-down coordinate
74-
/// system (as is common for graphics), it is a clockwise rotation, and
75-
/// in Y-up (traditional for math), it is anti-clockwise.
76-
///
77-
/// The angle, `th`, is expressed in radians.
78-
#[inline]
79-
pub fn rotate(th: f64) -> Affine {
80-
let (s, c) = th.sin_cos();
81-
Affine([c, s, -s, c, 0.0, 0.0])
82-
}
83-
8470
/// An affine transform representing translation.
8571
#[inline]
8672
pub fn translate<V: Into<Vec2>>(p: V) -> Affine {

common/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
// Use of this source code is governed by a BSD-style license that can be
99
// found in the LICENSE.chromium file.
1010

11+
#![cfg_attr(not(any(feature = "pyo3", feature = "schemars")), no_std)]
12+
13+
extern crate alloc;
14+
15+
use alloc::{boxed::Box, string::String, vec::Vec};
16+
use core::fmt;
1117
#[cfg(feature = "pyo3")]
1218
use pyo3::pyclass;
1319
#[cfg(feature = "schemars")]
@@ -22,7 +28,6 @@ use serde::{
2228
ser::{SerializeMap, Serializer},
2329
Deserialize, Serialize,
2430
};
25-
use std::fmt;
2631

2732
mod geometry;
2833
pub use geometry::{Affine, Point, Rect, Size, Vec2};

consumer/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ rust-version.workspace = true
1414
[dependencies]
1515
accesskit = { version = "0.16.3", path = "../common" }
1616
immutable-chunkmap = "2.0.5"
17-

platforms/atspi-common/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ atspi-common = { version = "0.6", default-features = false }
2121
serde = "1.0"
2222
thiserror = "1.0"
2323
zvariant = { version = "4.2", default-features = false }
24+

platforms/macos/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ objc2-app-kit = { version = "0.2.0", features = [
3434
"NSView",
3535
"NSWindow",
3636
] }
37+

platforms/unix/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ tokio-stream = { version = "0.1.14", optional = true }
3636
version = "1.32.0"
3737
optional = true
3838
features = ["macros", "net", "rt", "sync", "time"]
39-

platforms/windows/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ features = [
3737
once_cell = "1.13.0"
3838
scopeguard = "1.1.0"
3939
winit = "0.30"
40-

platforms/winit/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@ accesskit_unix = { version = "0.12.3", path = "../unix", optional = true, defaul
4040
version = "0.30"
4141
default-features = false
4242
features = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
43-

0 commit comments

Comments
 (0)