diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88d967f..97fcf98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,24 @@ on: [push, pull_request] jobs: test: + name: Test Suite + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - beta + - nightly + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - name: Run cargo test + run: cargo test + + test-msrv: name: Test Suite runs-on: ubuntu-latest strategy: @@ -25,7 +43,9 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Run cargo test - run: cargo test + # Exclude doctests here, as we don't want to clutter docs themselves + # with backwards compatibility workarounds. + run: cargo test --lib nightly: name: Test Suite (nightly features) diff --git a/README.md b/README.md index b109023..f7eb2a8 100644 --- a/README.md +++ b/README.md @@ -21,17 +21,9 @@ memoffset = "0.6" These versions will compile fine with rustc versions greater or equal to 1.19. -Add the following lines at the top of your `main.rs` or `lib.rs` files. - -```rust,ignore -#[macro_use] -extern crate memoffset; -``` - ## Examples ## ```rust -#[macro_use] -extern crate memoffset; +use memoffset::{offset_of, span_of}; #[repr(C, packed)] struct Foo { diff --git a/src/lib.rs b/src/lib.rs index 67de5e4..59ded24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,8 +24,7 @@ //! //! ## Examples //! ``` -//! #[macro_use] -//! extern crate memoffset; +//! use memoffset::{offset_of, span_of}; //! //! #[repr(C, packed)] //! struct HelpMeIAmTrappedInAStructFactory { @@ -75,7 +74,7 @@ extern crate doc_comment; #[cfg(doctest)] doctest!("../README.md"); -/// Hiden module for things the macros need to access. +/// Hidden module for things the macros need to access. #[doc(hidden)] pub mod __priv { #[doc(hidden)] diff --git a/src/offset_of.rs b/src/offset_of.rs index d376498..8596e45 100644 --- a/src/offset_of.rs +++ b/src/offset_of.rs @@ -72,8 +72,7 @@ macro_rules! _memoffset_offset_from_unsafe { /// /// ## Examples /// ``` -/// #[macro_use] -/// extern crate memoffset; +/// use memoffset::offset_of; /// /// #[repr(C, packed)] /// struct Foo { @@ -103,8 +102,7 @@ macro_rules! offset_of { /// /// ## Examples /// ``` -/// #[macro_use] -/// extern crate memoffset; +/// use memoffset::offset_of_tuple; /// /// fn main() { /// assert!(offset_of_tuple!((u8, u32), 1) >= 0, "Tuples do not have a defined layout"); diff --git a/src/span_of.rs b/src/span_of.rs index fe69e1e..aab9d0a 100644 --- a/src/span_of.rs +++ b/src/span_of.rs @@ -59,8 +59,7 @@ macro_rules! _memoffset__compile_error { /// /// ## Examples /// ``` -/// #[macro_use] -/// extern crate memoffset; +/// use memoffset::span_of; /// /// #[repr(C)] /// struct Florp {