Skip to content

Commit

Permalink
Flag library as #![no_std], add crate docs (WebAssembly#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton authored Nov 25, 2019
1 parent 864f12e commit 686e134
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
36 changes: 36 additions & 0 deletions crates/generate-raw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,46 @@ pub fn generate(wasi: &Path) -> String {
let mut raw = String::new();
raw.push_str(
"\
//! Raw API bindings to the WebAssembly System Interface (WASI)
//!
//! This crate provides Rust API bindings to WASI APIs. All WASI APIs are
//! exported from this crate and provided with the appropriate type signatures.
//! This crate is entirely procedurally generated from the `*.witx` files that
//! describe the WASI API.
//!
//! # WASI API Version
//!
//! The WASI API is evolving over time. It is both gaining new features as well
//! as tweaking the ABI of existing features. As a result it's important to
//! understand what version of this crate you're using and how it relates to
//! the WASI version of the spec.
//!
//! The WASI specification is organized into phases where there is a snapshot
//! at any one point in time describing the current state of the specification.
//! This crate implements a particular snapshot. You can find the snapshot
//! version implemented in this crate in the build metadata of the crate
//! version number. For example something like:
//!
//! 0.8.0+wasi-snapshot-preview1
//!
//! Means that this crate's own personal version is 0.8.0 and it implements the
//! `wasi-snapshot-preview1` snapshot. A major release of this crate (i.e.
//! bumping the \"0.8.0\") is expected whenever the generated code changes
//! or a new WASI snapshot is used.
//!
//! # Crate Features
//!
//! This crate supports one feature, `std`, which implements the standard
//! `Error` trait for the exported [`Error`] type in this crate. This is
//! enabled by default but can be disabled to make the library `no_std`
//! compatible.
// This file is automatically generated, DO NOT EDIT
//
// To regenerate this file run the `crates/generate-raw` command
#![no_std]
use core::mem::MaybeUninit;
mod error;
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ impl fmt::Debug for Error {
}
}

#[cfg(feature = "std")]
extern crate std;
#[cfg(feature = "std")]
impl std::error::Error for Error {}
36 changes: 36 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
//! Raw API bindings to the WebAssembly System Interface (WASI)
//!
//! This crate provides Rust API bindings to WASI APIs. All WASI APIs are
//! exported from this crate and provided with the appropriate type signatures.
//! This crate is entirely procedurally generated from the `*.witx` files that
//! describe the WASI API.
//!
//! # WASI API Version
//!
//! The WASI API is evolving over time. It is both gaining new features as well
//! as tweaking the ABI of existing features. As a result it's important to
//! understand what version of this crate you're using and how it relates to
//! the WASI version of the spec.
//!
//! The WASI specification is organized into phases where there is a snapshot
//! at any one point in time describing the current state of the specification.
//! This crate implements a particular snapshot. You can find the snapshot
//! version implemented in this crate in the build metadata of the crate
//! version number. For example something like:
//!
//! 0.8.0+wasi-snapshot-preview1
//!
//! Means that this crate's own personal version is 0.8.0 and it implements the
//! `wasi-snapshot-preview1` snapshot. A major release of this crate (i.e.
//! bumping the "0.8.0") is expected whenever the generated code changes
//! or a new WASI snapshot is used.
//!
//! # Crate Features
//!
//! This crate supports one feature, `std`, which implements the standard
//! `Error` trait for the exported [`Error`] type in this crate. This is
//! enabled by default but can be disabled to make the library `no_std`
//! compatible.
// This file is automatically generated, DO NOT EDIT
//
// To regenerate this file run the `crates/generate-raw` command

#![no_std]

use core::mem::MaybeUninit;

mod error;
Expand Down

0 comments on commit 686e134

Please sign in to comment.