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/
**/*.rs.bk
Cargo.lock
.idea/
cmake-build-debug/

View File

@ -1,6 +1,6 @@
[package]
name = "memoffset"
version = "0.1.0"
version = "0.2.0"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT"
@ -10,7 +10,3 @@ keywords = ["mem", "offset", "offset_of", "offsetof"]
categories = ["no-std"]
[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.
* `span_of!` for obtaining the range that a field, or fields, span.
`memoffset` works under `no_std` environments.
## Usage ##
Add the following dependency to your `Cargo.toml`:
```toml
[dependencies]
memoffset = "0.1"
```
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 }
memoffset = "0.2"
```
Add the following lines at the top of your `main.rs` or `lib.rs` files.
@ -48,4 +44,4 @@ assert_eq!(span_of!(Foo, a .. c[1]), 0..9);
assert_eq!(span_of!(Foo, a ..= c[1]), 0..10);
assert_eq!(span_of!(Foo, ..= d), 0..14);
assert_eq!(span_of!(Foo, b ..), 4..17);
```
```

View File

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

View File

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