Bumped version to 0.2

This commit is contained in:
Gilad Naaman 2018-01-13 19:37:05 +02:00
parent 03cc3186d2
commit a9cc05526c
5 changed files with 11 additions and 21 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/target/ /target/
**/*.rs.bk **/*.rs.bk
Cargo.lock Cargo.lock
.idea/
cmake-build-debug/

View File

@ -1,6 +1,6 @@
[package] [package]
name = "memoffset" name = "memoffset"
version = "0.1.0" version = "0.2.0"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"] authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs." description = "offset_of functionality for Rust structs."
license = "MIT" license = "MIT"
@ -10,7 +10,3 @@ keywords = ["mem", "offset", "offset_of", "offsetof"]
categories = ["no-std"] categories = ["no-std"]
[dependencies] [dependencies]
[features]
default = ["std"]
std = []

View File

@ -8,18 +8,14 @@ Introduces the following macros:
* `offset_of!` for obtaining the offset of a member of a struct. * `offset_of!` for obtaining the offset of a member of a struct.
* `span_of!` for obtaining the range that a field, or fields, span. * `span_of!` for obtaining the range that a field, or fields, span.
`memoffset` works under `no_std` environments.
## Usage ## ## Usage ##
Add the following dependency to your `Cargo.toml`: Add the following dependency to your `Cargo.toml`:
```toml ```toml
[dependencies] [dependencies]
memoffset = "0.1" memoffset = "0.2"
```
If you're working in a no-std environment, use the following dependency instead (functionality is identical):
```toml
[dependencies]
memoffset = { version = "0.1", default-features = false }
``` ```
Add the following lines at the top of your `main.rs` or `lib.rs` files. Add the following lines at the top of your `main.rs` or `lib.rs` files.

View File

@ -57,14 +57,10 @@
//! let checksum = crc16(checksum_range); //! let checksum = crc16(checksum_range);
//! ``` //! ```
// Support for the usage of this crate without the standard library. #![no_std]
#![cfg_attr(not(feature="std"), no_std)]
#[cfg(feature = "std")] // This `use` statement enables the macros to use `$crate::mem`.
#[doc(hidden)] // Doing this enables this crate to function under both std and no-std crates.
pub use std::mem;
#[cfg(not(feature = "std"))]
#[doc(hidden)] #[doc(hidden)]
pub use core::mem; pub use core::mem;

View File

@ -132,7 +132,7 @@ macro_rules! span_of {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::mem; use ::core::mem;
#[repr(C, packed)] #[repr(C, packed)]
struct Foo { struct Foo {