Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for no_std #253

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ jobs:
- run: cargo build --verbose --target wasm32-unknown-unknown
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
- run: cargo build --verbose --no-default-features
- run: cargo build --verbose --target wasm32-unknown-unknown --no-default-features
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
- run: cargo test --verbose
- run: (cd examples/hello && cargo build --features glutin)
- run: (cd examples/hello && cargo build --target wasm32-unknown-unknown)
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ name = "glow"
path = "src/lib.rs"

[dependencies]
ahash = { version = "0.8.3", default-features = false }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be optional when targeting std

hashbrown = { version = "0.14.0", default-features = false }
log = { version = "0.4.16", optional = true }

[features]
default = ["std"]
debug_trace_calls = []
debug_automatic_glGetError = []
std = ["ahash/std"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "~0.3"
Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
#![allow(clippy::unreadable_literal)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::pedantic)] // For anyone using pedantic and a source dep, this is needed
#![no_std]

extern crate alloc;

use alloc::string::String;
use alloc::vec::Vec;
use core::fmt::Debug;
use core::hash::Hash;
use std::collections::HashSet;

mod version;
pub use version::Version;
Expand Down Expand Up @@ -95,7 +99,7 @@ pub trait HasContext {
type TransformFeedback: Copy + Clone + Debug + Eq + Hash + Ord + PartialEq + PartialOrd;
type UniformLocation: Clone + Debug;

fn supported_extensions(&self) -> &HashSet<String>;
fn supports_extension(&self, extension: &str) -> bool;

fn supports_debug(&self) -> bool;

Expand Down
Loading