commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
3e44128b0f4345b90bcb084af5bb4c421db87e96 | theduke | 2017-01-09T08:45:24 | Fixed copy/pasted comment for DiskInfo | diff --git a/lib.rs b/lib.rs
index 3224e13..3999cd6 100644
--- a/lib.rs
+++ b/lib.rs
@@ -38,7 +38,7 @@ pub struct MemInfo {
pub swap_free: u64,
}
-/// System momory information.
+/// Disk information.
#[repr(C)]
pub struct DiskInfo {
pub total: u64, | 1 | 1 | 1 |
494aa00ddd1044f4b93760cd21d7e52f3e07f977 | theduke | 2017-01-09T08:29:51 | Improve error handling.
* Made Error type implement std::error::Error
* added new error variant IO for file read errors
* improved some of the parsing code for /proc files | diff --git a/lib.rs b/lib.rs
index 58998d9..3224e13 100644
--- a/lib.rs
+++ b/lib.rs
@@ -6,7 +6,8 @@
//!
use std::ffi;
-use std::io::Read;
+use std::fmt;
+use std::io::{self, Read};
use std::fs::File;
@@ -48,7 +49,49 @@ pub struct DiskInfo {
#[derive(Debug)]
pub enum Error {
UnsupportedSystem,
- Exec... | 1 | 100 | 92 |
574dc3fd8eae17be0b98ffb84232e87b5f3bec43 | Siyu Wang | 2015-08-17T10:07:39 | use enum Error | diff --git a/Cargo.toml b/Cargo.toml
index 36fb2e7..cd53cfc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "sys-info"
-version = "0.4.0"
+version = "0.4.1"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
diff --git a/lib.rs b/lib.rs
index c5837c6..3... | 2 | 28 | 21 |
5d110f9ecb2822a12ff95b7e2e86161c054e07c7 | FillZpp | 2015-07-22T09:55:26 | improve introduction | diff --git a/Cargo.toml b/Cargo.toml
index 89c85ca..36fb2e7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ version = "0.4.0"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
-keywords = ["system", "cpu", "disk", "memory"]
+keywords = ["system", "cpu", "disk", "memory", "... | 1 | 1 | 1 |
d52ed85e011f924ae22e03832f526c4cd684d05a | Siyu Wang | 2015-04-16T21:14:19 | fix bug on linux | diff --git a/Cargo.toml b/Cargo.toml
index 52274f4..646fa4b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "sys-info"
-version = "0.3.3"
+version = "0.3.4"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
diff --git a/lib.rs b/lib.rs
index 564479f..c... | 2 | 3 | 3 |
6bb810eddf8c76ac70abb907b276692da4f74967 | Siyu Wang | 2015-04-04T07:01:50 | delete static | diff --git a/lib.rs b/lib.rs
index a31878a..564479f 100644
--- a/lib.rs
+++ b/lib.rs
@@ -8,7 +8,6 @@
use std::ffi;
use std::io::Read;
use std::fs::File;
-use std::sync::{Once, ONCE_INIT};
/// System load average value.
@@ -100,15 +99,8 @@ pub fn os_release() -> Result<String, String> {
///
/// Notice, it retu... | 1 | 15 | 32 |
75d066cc762c38fbe2da8e964bb34b6962cfacdc | Siyu Wang | 2015-04-04T05:02:05 | fix for rust-1.0-beta | diff --git a/Cargo.toml b/Cargo.toml
index 44be8a4..22f87b6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "sys-info"
-version = "0.3.1"
+version = "0.3.2"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
diff --git a/lib.rs b/lib.rs
index 25c8993..a... | 3 | 21 | 56 |
473d13ad13ba03749d810512fc6d1ad9dd0f1a61 | Siyu Wang | 2015-04-02T15:00:43 | delete feature convert | diff --git a/lib.rs b/lib.rs
index 5cfe0da..25c8993 100644
--- a/lib.rs
+++ b/lib.rs
@@ -1,5 +1,5 @@
#![feature(core)]
-#![feature(convert)]
+
//! #Introduction
//! This crate focuses on geting system information. | 1 | 1 | 1 |
50ba2fc6c13e7ed1f72ad317ebb35a264e50a646 | Siyu Wang | 2015-03-29T05:11:25 | fix as_ref | diff --git a/lib.rs b/lib.rs
index 0efbd51..5cfe0da 100644
--- a/lib.rs
+++ b/lib.rs
@@ -152,8 +152,7 @@ pub fn cpu_speed() -> Result<u64, String> {
let mut f = File::open("/proc/cpuinfo").unwrap();
let mut s = String::new();
let _ = f.read_to_string(&mut s... | 1 | 4 | 8 |
1bbbe83d125f0fa69e18bc4e5100e05e3dbb8806 | Siyu Wang | 2015-03-27T09:50:55 | use as_ref() instead | diff --git a/Cargo.toml b/Cargo.toml
index bd0f999..44be8a4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "sys-info"
-version = "0.2.5"
+version = "0.3.1"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
diff --git a/lib.rs b/lib.rs
index b7d9b9e..0... | 2 | 10 | 5 |
1c47f52af8d3383f1848b425ac36fb91cae9220a | Siyu Wang | 2015-03-27T05:31:51 | fix cargo | diff --git a/Cargo.toml b/Cargo.toml
index a894b51..a3fdb7e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ license = "MIT"
readme = "README.md"
keywords = ["system", "cpu", "disk", "memory"]
repository = "https://github.com/FillZpp/sys-info-rs"
-documentation = "http://docs.fillzpp.org/sys-info-rs/sys-info... | 1 | 1 | 1 |
1ced098304301f7facb28b94653ea67ec8cf2f9c | Siyu Wang | 2015-03-16T13:17:12 | fix for nightly rustc | diff --git a/lib.rs b/lib.rs
index 3a8fdba..fa74375 100644
--- a/lib.rs
+++ b/lib.rs
@@ -1,5 +1,4 @@
#![feature(core)]
-#![feature(io)]
//! #Introduction
//! This crate focuses on geting system information. | 1 | 0 | 1 |
66b17ee9686624e0fe3a466c435a5343446c55c3 | Siyu Wang | 2015-03-08T15:09:31 | fix test | diff --git a/test/src/main.rs b/test/src/main.rs
index a9d28eb..d0ea9a8 100644
--- a/test/src/main.rs
+++ b/test/src/main.rs
@@ -1,6 +1,6 @@
#![feature(test)]
-extern crate sys_info;
+extern crate "sys-info" as sys_info;
extern crate test;
use sys_info::*; | 1 | 1 | 1 |
6dc9f9d641ff4a7a3f8c9c04f3d52d1370f5a350 | Siyu Wang | 2015-03-08T20:36:49 | change lib name | diff --git a/Cargo.toml b/Cargo.toml
index 58298aa..362ae20 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ links = "info"
build = "build.rs"
[lib]
-name = "sys_info"
+name = "sys-info"
path = "lib.rs"
[build-dependencies] | 1 | 1 | 1 |
c02a48df9daa1c157e769a0004d376a5b3ff414b | Siyu Wang | 2015-03-08T20:08:42 | fix feature | diff --git a/lib.rs b/lib.rs
index 33fc1a5..3a8fdba 100644
--- a/lib.rs
+++ b/lib.rs
@@ -1,8 +1,5 @@
#![feature(core)]
-#![feature(std_misc)]
-#![feature(fs)]
#![feature(io)]
-#![feature(process)]
//! #Introduction
//! This crate focuses on geting system information. | 1 | 0 | 3 |
5102a649454991c933d6cda2effb1ca9d30f3c51 | Siyu Wang | 2015-03-02T15:10:17 | add proc_total support for windows | diff --git a/Cargo.toml b/Cargo.toml
index 08880b2..2128165 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "sys-info"
-version = "0.2.1"
+version = "0.2.2"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
diff --git a/build.rs b/build.rs
index d764ca... | 2 | 2 | 1 |
ce8af5622c43e150405ab67d5e39c13359083f67 | Siyu Wang | 2015-03-01T08:57:40 | add bench in test | diff --git a/test/src/main.rs b/test/src/main.rs
index 59c3ae1..d0ea9a8 100644
--- a/test/src/main.rs
+++ b/test/src/main.rs
@@ -1,6 +1,10 @@
+#![feature(test)]
+
extern crate "sys-info" as sys_info;
+extern crate test;
use sys_info::*;
+use test::Bencher;
fn main() {
@@ -18,3 +22,14 @@ fn main() {
printl... | 1 | 15 | 0 |
a1490362ae185edfd2d16551c411e3cfba47ef33 | Siyu Wang | 2015-02-27T10:15:44 | fix static bug on linux | diff --git a/lib.rs b/lib.rs
index 051b6c4..33fc1a5 100644
--- a/lib.rs
+++ b/lib.rs
@@ -16,19 +16,7 @@ use std::str;
use std::io::Read;
use std::fs::File;
use std::sync::{Once, ONCE_INIT};
-
-static mut OS_TYPE: &'static str = "";
-static OS_TYPE_INIT: Once = ONCE_INIT;
-
-static mut OS_RELEASE: &'static str = "";
... | 1 | 16 | 18 |
741156ba57842c721f2b490b80785b5189ba52df | Siyu Wang | 2015-02-26T12:35:26 | change static for immutable information | diff --git a/Cargo.toml b/Cargo.toml
index eb6b5f9..08880b2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "sys-info"
-version = "0.1.4"
+version = "0.2.1"
authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
readme = "README.md"
diff --git a/lib.rs b/lib.rs
index c3feb4b..0... | 3 | 86 | 55 |
488d261a80e8ffa32dedef54ebb3edcf8ec1c0af | Siyu Wang | 2015-02-24T08:27:44 | add a comment | diff --git a/lib.rs b/lib.rs
index 4483ee6..c3feb4b 100644
--- a/lib.rs
+++ b/lib.rs
@@ -245,6 +245,7 @@ pub fn disk_info() -> Result<DiskInfo, String> {
}
}
+/// Get hostname.
pub fn hostname() -> Result<String, String> {
use std::process::Command;
if cfg!(unix) { | 1 | 1 | 0 |
1242f3ef913ed8fd5ece42b01d530bfcadf26848 | Siyu Wang | 2015-02-21T15:59:50 | change name and documentation | diff --git a/Cargo.toml b/Cargo.toml
index b4522fd..834846b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,13 +1,12 @@
[package]
-name = "sys-info-rs"
+name = "sys-info"
version = "0.1.1"
-authors = ["Siyu Wang <FillZpp.pub@gmail.com"]
+authors = ["Siyu Wang <FillZpp.pub@gmail.com>"]
license = "MIT"
-
readme = "R... | 1 | 3 | 4 |
6bb8628596f2fe221b27db5d7a5d06684d196e0b | Siyu Wang | 2015-02-21T15:43:55 | perfect comments | diff --git a/lib.rs b/lib.rs
index ff7e183..2e06bff 100644
--- a/lib.rs
+++ b/lib.rs
@@ -17,14 +17,18 @@ use std::fs::File;
/// System load average value.
#[repr(C)]
pub struct LoadAvg {
+ /// Average load value within one minite.
pub one: f64,
+ /// Average load value within five minites.
pub five: ... | 1 | 5 | 0 |
f038e5f27620ad3cb51157722f3019f6916b41fa | Siyu Wang | 2015-02-21T03:22:19 | change test | diff --git a/lib.rs b/lib.rs
index 916bd65..ff7e183 100644
--- a/lib.rs
+++ b/lib.rs
@@ -241,14 +241,42 @@ pub fn disk_info() -> Result<DiskInfo, String> {
#[test]
-fn test() {
+fn test_os_type() {
os_type().unwrap();
+}
+
+#[test]
+fn test_os_release() {
os_release().unwrap();
+}
+
+#[test]
+fn test_cpu... | 1 | 29 | 1 |
ebcfff1f6227b070e5fa99726128fe3350cc32f0 | Siyu Wang | 2015-02-21T03:12:39 | fix that change cpu_speed read file | diff --git a/lib.rs b/lib.rs
index d23cb6c..916bd65 100644
--- a/lib.rs
+++ b/lib.rs
@@ -120,14 +120,19 @@ pub fn cpu_num() -> Result<u32, String> {
pub fn cpu_speed() -> Result<u64, String> {
if cfg!(target_os = "linux") {
// /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
- let mut f =
- ... | 1 | 11 | 6 |
6ae54ff75587d2a578a42c0b7659eb23f20785ba | Siyu Wang | 2015-02-21T02:47:19 | new alpha2 says deprecated, make it happy | diff --git a/lib.rs b/lib.rs
index 125db7a..d23cb6c 100644
--- a/lib.rs
+++ b/lib.rs
@@ -71,8 +71,8 @@ pub fn os_type() -> Result<String, String> {
cfg!(target_os = "windows")
{
Ok(unsafe {
- let s = get_os_type();
- String::from_utf8_lossy(ffi::c_str_to_bytes(&s)).into_owne... | 1 | 4 | 4 |
4892a96cd6dbb7359f16e0e1d7ed146d937ac3ea | Siyu Wang | 2015-02-19T15:25:39 | add libc | diff --git a/Cargo.toml b/Cargo.toml
index b2030de..e868e9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,8 +19,8 @@ build = "build.rs"
name = "sys-info"
path = "lib.rs"
-#[dependencies]
-#libc = "*"
+[dependencies]
+libc = "*"
[build-dependencies]
gcc = "*"
diff --git a/lib.rs b/lib.rs
index f257248..11a7691... | 2 | 10 | 8 |
e6518a068cbe9bd6953343146cdf1b0a750276dd | Siyu Wang | 2015-02-19T15:06:32 | comment libc dependencies | diff --git a/Cargo.toml b/Cargo.toml
index e868e9f..b2030de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,8 +19,8 @@ build = "build.rs"
name = "sys-info"
path = "lib.rs"
-[dependencies]
-libc = "*"
+#[dependencies]
+#libc = "*"
[build-dependencies]
gcc = "*" | 1 | 2 | 2 |
ef37d67cdc7c99c03b45c716f4c40091e7f18895 | Bruce Mitchener | 2023-11-14T00:42:37 | clippy: Suppress `identity_op` lint.
This code is for tetss and is to line up and draw attention to the
offsets. Better to suppress than eliminate. | diff --git a/src/offset_of.rs b/src/offset_of.rs
index f5a7ba6..dbd0991 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -200,6 +200,8 @@ macro_rules! offset_of_union {
#[cfg(test)]
mod tests {
+ #![cfg_attr(allow_clippy, allow(clippy::identity_op))] // For `... + 0` constructs below.
+
#[test]
... | 1 | 2 | 0 |
5e9c14715a1c4bb21ea1bffea8502ad4cebbd86b | Bruce Mitchener | 2023-11-13T16:09:35 | docs: Add some missing backticks. | diff --git a/src/offset_of.rs b/src/offset_of.rs
index f5a7ba6..bc0497d 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -186,7 +186,7 @@ macro_rules! _memoffset__offset_of_union_impl {
/// ```
///
/// ## Note
-/// Due to macro_rules limitations, this macro will accept structs with a single field as well as u... | 2 | 2 | 2 |
be84d6f44861a289bc797be0560bedaa7ab5db19 | Bruce Mitchener | 2023-11-13T16:08:01 | clippy: Fix `needless-doctest-main` lints. | diff --git a/src/lib.rs b/src/lib.rs
index ccf182b..b4760a4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -32,11 +32,9 @@
//! a: u32
//! }
//!
-//! fn main() {
-//! assert_eq!(offset_of!(HelpMeIAmTrappedInAStructFactory, a), 15);
-//! assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, a), 15..19);
-//! ... | 3 | 14 | 24 |
033de8e125b79db5d7c8690c2f47686b81cdbe56 | Gilad Naaman | 2023-05-19T15:45:21 | Explain macro indirection
`offset_of!` implementation was moved to an internal macro
`_memoffset__offset_of_impl!` in
[PR #72](https://github.com/Gilnaa/memoffset/pull/72).
This was done in order to have a single top-level macro that
doc-comments can be attached to. | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 190ca72..df1c84a 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -121,6 +121,8 @@ macro_rules! _memoffset__offset_of_impl {
#[macro_export(local_inner_macros)]
macro_rules! offset_of {
($parent:path, $field:tt) => {
+ // Macro implementation i... | 1 | 4 | 0 |
a380cb810818a3e3a205ce6d178ac2348c243a3b | Gilad Naaman | 2023-05-19T03:55:51 | Version 0.9.0
Changelog:
- Added support for unstable std offset-of polyfill (PR#72) | diff --git a/Cargo.toml b/Cargo.toml
index 981491c..ef70063 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "memoffset"
-version = "0.8.0"
+version = "0.9.0"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT" | 1 | 1 | 1 |
274dacc252cf4e4edb6420ddfffc23aff2c66e5b | est31 | 2023-05-17T05:14:28 | Add unstable_offset_of feature to use the unstable offset_of macro | diff --git a/Cargo.toml b/Cargo.toml
index 71bdc9e..981491c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,3 +18,4 @@ doc-comment = "0.3"
[features]
default = []
unstable_const = []
+unstable_offset_of = []
diff --git a/src/lib.rs b/src/lib.rs
index 72736aa..ccf182b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -61,6... | 3 | 62 | 16 |
d8accb76712984e2ab069193f392e5a7b6c5e78c | Gilad Naaman | 2022-10-17T06:29:35 | Version 0.7.1
Re-publish with updated README | diff --git a/Cargo.toml b/Cargo.toml
index c4bd710..90620e2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "memoffset"
-version = "0.7.0"
+version = "0.7.1"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT" | 1 | 1 | 1 |
f1ae392759c8b5efb5d7c31cd4889f0837fcfe4e | Gilad Naaman | 2022-10-17T06:25:20 | Version 0.7.0
Support unions and update docs:
- https://github.com/Gilnaa/memoffset/issues/66
- https://github.com/Gilnaa/memoffset/issues/23
- https://github.com/Gilnaa/memoffset/issues/59 | diff --git a/Cargo.toml b/Cargo.toml
index 7a62858..c4bd710 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "memoffset"
-version = "0.6.5"
+version = "0.7.0"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT" | 1 | 1 | 1 |
eb2a79cb6dfefdb15e81f59424ba4d4835f3b2ac | Gilad Naaman | 2022-10-16T14:49:41 | Update docs WRT repr(Rust) (#69)
Issue:
- https://github.com/Gilnaa/memoffset/issues/59 | diff --git a/src/offset_of.rs b/src/offset_of.rs
index f2800de..d070181 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -86,6 +86,16 @@ macro_rules! _memoffset_offset_from_unsafe {
/// assert_eq!(offset_of!(Foo, b), 4);
/// }
/// ```
+///
+/// ## Notes
+/// Rust's ABI is unstable, and [type layout can be... | 2 | 18 | 1 |
af6689589f2cdabe5c32c2e0fd777afa6ff68195 | Gilad Naaman | 2022-10-10T19:00:44 | Add some compile-fail tests. (#68)
Ticket:
- https://github.com/Gilnaa/memoffset/issues/23 | diff --git a/src/raw_field.rs b/src/raw_field.rs
index c804b39..e16df9f 100644
--- a/src/raw_field.rs
+++ b/src/raw_field.rs
@@ -39,6 +39,21 @@ macro_rules! _memoffset__addr_of {
}
/// Deref-coercion protection macro.
+///
+/// Prevents complilation if the specified field name is not a part of the
+/// struct defin... | 1 | 35 | 0 |
6a48918fd10380a8429b6ebe7fd500a86fe4138a | Gilad Naaman | 2022-10-10T17:46:09 | Update src/raw_field.rs
Co-authored-by: Ralf Jung <post@ralfj.de> | diff --git a/src/raw_field.rs b/src/raw_field.rs
index c938bb4..c804b39 100644
--- a/src/raw_field.rs
+++ b/src/raw_field.rs
@@ -172,8 +172,8 @@ macro_rules! raw_field_tuple {
/// This macro is the same as `raw_field`, except for a different Deref-coercion check that
/// supports unions.
/// Due to macro_rules limit... | 1 | 2 | 2 |
b17ae388df6388ec2e98e34e7553f17f2f023550 | Gilad Naaman | 2022-10-10T17:45:55 | Update src/offset_of.rs
Co-authored-by: Ralf Jung <post@ralfj.de> | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 54fd3e0..f2800de 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -139,9 +139,9 @@ macro_rules! offset_of_tuple {
/// ```
///
/// ## Note
-/// Due to macro_rules limitations, this check will accept structs with a single field as well as unions.
-/// Using... | 1 | 3 | 3 |
71c39fbdfbada0a9df7973324d91c8490081c0be | Gilad Naaman | 2022-10-10T14:48:18 | Support unions in offset_of(_union) | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 8596e45..54fd3e0 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -121,6 +121,39 @@ macro_rules! offset_of_tuple {
}};
}
+/// Calculates the offset of the specified union member from the start of the union.
+///
+/// ## Examples
+/// ```
+/// use mem... | 2 | 127 | 0 |
2a74b62c26724ff9c67e4e3ad05378a1af53f195 | yvt | 2022-02-24T03:19:16 | Suppress `clippy::unneeded_wildcard_pattern` (#64) | diff --git a/src/raw_field.rs b/src/raw_field.rs
index a8dd2b3..3a9e62b 100644
--- a/src/raw_field.rs
+++ b/src/raw_field.rs
@@ -64,6 +64,17 @@ macro_rules! _memoffset__field_check {
}
/// Deref-coercion protection macro.
+#[cfg(allow_clippy)]
+#[macro_export]
+#[doc(hidden)]
+macro_rules! _memoffset__field_check_t... | 1 | 11 | 0 |
bf9450ea191a694d0700ea27efb91353cffbad40 | Ralf Jung | 2021-03-27T14:30:05 | fix build on old rustc | diff --git a/src/lib.rs b/src/lib.rs
index d0c1b55..454759e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,7 +87,7 @@ pub mod __priv {
/// Use type inference to obtain the size of the pointee (without actually using the pointer).
#[doc(hidden)]
pub fn size_of_pointee<T>(_ptr: *const T) -> usize {
- ... | 1 | 1 | 1 |
4746d5a0a8db2bb5be1f0a3c417606bfe76eb4dd | Ralf Jung | 2021-03-27T14:22:37 | move mem and ptr into __priv | diff --git a/src/lib.rs b/src/lib.rs
index bd14fda..d0c1b55 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -76,16 +76,14 @@ extern crate doc_comment;
#[cfg(doctest)]
doctest!("../README.md");
-// This `use` statement enables the macros to use `$crate::mem`.
-// Doing this enables this crate to function under both std ... | 3 | 9 | 11 |
5f9e008def08a2ee5651f33a91ad73271cd8fc30 | Ralf Jung | 2021-03-27T14:21:43 | avoid use of size_of_val in span_of | diff --git a/src/lib.rs b/src/lib.rs
index 683b91b..bd14fda 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,6 +83,16 @@ pub use core::mem;
#[doc(hidden)]
pub use core::ptr;
+/// Hiden module to things the macros need to access.
+#[doc(hidden)]
+pub mod __priv {
+ /// Use type inference to obtain the size of the ... | 2 | 28 | 24 |
ca3425e81a5235643449a87d9fa819f06dc4c8f1 | Ralf Jung | 2021-03-26T08:52:02 | rename _memoffset_offset_from macro to reflect that it is unsafe to call | diff --git a/src/offset_of.rs b/src/offset_of.rs
index b19458c..12653bd 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -49,7 +49,7 @@ macro_rules! _memoffset__let_base_ptr {
#[cfg(feature = "unstable_const")]
#[macro_export]
#[doc(hidden)]
-macro_rules! _memoffset_offset_from {
+macro_rules! _memoffset_offs... | 1 | 4 | 4 |
e66b61937de3c976f4c0c1f7d76676c4cfb59201 | Ralf Jung | 2021-03-25T23:01:10 | avoid putting user code inside unsafe blocks | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 2ffb79c..b19458c 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -50,11 +50,13 @@ macro_rules! _memoffset__let_base_ptr {
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset_offset_from {
- ($field:expr, $base:expr) => {
+ ($field:expr, $base:ex... | 2 | 9 | 5 |
782c7d4408008688f594579fac60fc46b7c5f012 | Ralf Jung | 2020-06-22T08:43:53 | fix allow_clippy | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 1498cdf..d0a59ad 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -56,7 +56,7 @@ macro_rules! _memoffset_offset_from {
// Compute offset, with unstable `offset_from` for const-compatibility.
// (Requires the pointers to not dangle, but we a... | 2 | 28 | 7 |
6098248fd44f6d178ae5fb99c40f7664eb1cf454 | Ralf Jung | 2020-06-22T07:55:08 | share more code in raw_field | diff --git a/src/raw_field.rs b/src/raw_field.rs
index ec7255c..d4c523a 100644
--- a/src/raw_field.rs
+++ b/src/raw_field.rs
@@ -18,17 +18,24 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-/// Deref-coercion protection macro.
+/// `raw_const!`, or just ref-then-cas... | 1 | 24 | 34 |
a1a14b81201938ad47cd1ad96afc303b6c604ed6 | Ralf Jung | 2020-06-22T07:49:18 | factor difference between const and non-const into sub-macro | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 9a50fd7..1498cdf 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -42,11 +42,32 @@ macro_rules! _memoffset__let_base_ptr {
macro_rules! _memoffset__let_base_ptr {
($name:ident, $type:path) => {
// No UB right here, but we will later dereferenc... | 1 | 25 | 19 |
8c8900af68a5582859e3f1f1f70aa44eb6d87ad5 | Ralf Jung | 2020-06-21T10:12:34 | make the const variant closer to the normal variant (just the offset part is different) | diff --git a/src/lib.rs b/src/lib.rs
index 6291545..86d7051 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -63,7 +63,7 @@
ptr_offset_from,
const_ptr_offset_from,
const_transmute,
- const_raw_ptr_deref
+ const_raw_ptr_deref,
)
)]
#![cfg_attr(feature = "unstable_raw", feature(... | 3 | 19 | 29 |
eb7f7554ef135f3bf830e3cdb263b033ae12fd87 | Ralf Jung | 2020-06-21T10:00:25 | span_of: use raw_field macro for more safety | diff --git a/src/span_of.rs b/src/span_of.rs
index e893abf..0592dbd 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -93,39 +93,34 @@ macro_rules! span_of {
(@helper $root:ident, [] ..) => {
_memoffset__compile_error!("Expected a range, found '..'")
};
- // Lots of UB due to taking references t... | 1 | 14 | 19 |
b5e7f3febbdb1e0d30d2024a41955c951d9351af | Ralf Jung | 2020-06-21T09:53:48 | move raw_field macro to its own file | diff --git a/src/lib.rs b/src/lib.rs
index 39ec097..6291545 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,6 +83,8 @@ pub use core::mem;
#[doc(hidden)]
pub use core::ptr;
+#[macro_use]
+mod raw_field;
#[macro_use]
mod offset_of;
#[macro_use]
diff --git a/src/offset_of.rs b/src/offset_of.rs
index 25ab88f..72b15c... | 3 | 80 | 59 |
e8085721f3026278d9c03ade8e52d4984630fdc1 | Ralf Jung | 2020-03-16T19:26:44 | bump version for release | diff --git a/Cargo.toml b/Cargo.toml
index 0cc174e..cabe0ce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "memoffset"
-version = "0.5.3"
+version = "0.5.4"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT" | 1 | 1 | 1 |
4179c58af675279cce1ac4d068817849f05c1871 | Gilad Naaman | 2020-03-16T17:23:25 | Fixed build for 1.19 | diff --git a/build.rs b/build.rs
index 8bc3c9f..5749207 100644
--- a/build.rs
+++ b/build.rs
@@ -1,3 +1,5 @@
+extern crate autocfg;
+
fn main() {
let ac = autocfg::new(); | 1 | 2 | 0 |
449841d45dcdec6d2d88b6b7f231b4752d2c4e77 | Gilad Naaman | 2020-03-16T17:07:13 | Switch to autocfg from rustc_version | diff --git a/Cargo.toml b/Cargo.toml
index a7cf2e2..0cc174e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ keywords = ["mem", "offset", "offset_of", "offsetof"]
categories = ["no-std"]
[build-dependencies]
-rustc_version = "0.2.3"
+autocfg = "1"
[dev-dependencies]
doc-comment = "0.3"
diff --git a/bu... | 2 | 5 | 11 |
81a6523a09161e5826efd5dbc2bc6067c3380e7d | Ralf Jung | 2020-03-16T16:12:46 | avoid accessing libcore for compat with old Rust versions | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 5ddf49a..355c9c9 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -204,7 +204,7 @@ mod tests {
c: i64,
}
- let f: Foo = unsafe { core::mem::zeroed() };
+ let f: Foo = Foo { a: 0, b: [0, 0], c: 0 };
let f_ptr = &... | 1 | 1 | 1 |
3e5dcf2b1d3a882125d33d47aae1c2af458861fd | AnthonyMikh | 2020-03-09T23:07:14 | Fix a typo in comment | diff --git a/src/offset_of.rs b/src/offset_of.rs
index ac13f2e..5c80d9d 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -29,7 +29,7 @@ macro_rules! _memoffset__let_base_ptr {
// But we have to make sure that `uninit` lives long enough,
// so it has to be in the same scope as `$name`. That's wh... | 1 | 1 | 1 |
6a2923359e8a2cd864a0a08473dcf392ba57e77f | Ralf Jung | 2019-12-07T11:17:22 | better way to ignore tests in Miri | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 0308274..894860f 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -138,7 +138,7 @@ mod tests {
}
#[test]
- #[cfg(not(miri))] // this creates unaligned references
+ #[cfg_attr(miri, ignore)] // this creates unaligned references
fn offse... | 2 | 2 | 2 |
3415814930fd2b6410acd0d5640200399f341cab | Ralf Jung | 2019-11-17T19:45:27 | remove redundant namespacing from some features | diff --git a/build.rs b/build.rs
index e1c4f94..99990dd 100644
--- a/build.rs
+++ b/build.rs
@@ -9,10 +9,10 @@ fn main() {
// Check for a minimum version
if version >= Version::from((1, 36, 0)) {
- println!("cargo:rustc-cfg=memoffset_maybe_uninit");
+ println!("cargo:rustc-cfg=maybe_uninit");
... | 3 | 6 | 6 |
5a617d7cc543ca8022eee948e28b6e8ca4d7e18b | Ralf Jung | 2019-11-16T20:30:32 | allow clippy lint | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 0346dce..189a80d 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -53,6 +53,7 @@ macro_rules! _memoffset__field_check {
// Make sure the field actually exists. This line ensures that a
// compile-time error is generated if $field is accesse... | 1 | 1 | 0 |
ef0d8a7bf9d287033b3330a9c50656b8d895c263 | Gilad Naaman | 2019-11-07T16:37:37 | Fixed build for old nightlies where doctests were not present. | diff --git a/build.rs b/build.rs
index e7aa89c..e1c4f94 100644
--- a/build.rs
+++ b/build.rs
@@ -1,17 +1,18 @@
extern crate rustc_version;
-use rustc_version::{version, version_meta, Channel, Version};
+use rustc_version::{version, Version};
fn main() {
+ let version = version().unwrap();
+
// Assert we hav... | 2 | 9 | 9 |
d7070d4b2534e1623d857f49030b8dba01ede81d | Ralf Jung | 2019-08-28T18:11:08 | remove confusing comment | diff --git a/src/lib.rs b/src/lib.rs
index ac3f746..e152c1f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,9 +20,6 @@
//! A crate used for calculating offsets of struct members and their spans.
//!
-//! Some of the functionality of the crate makes no sense when used along with structs that
-//! are not `#[repr(C, ... | 1 | 0 | 3 |
86689325ee0bd87a7e6a6f626294c45ea0b39a62 | Amanieu d'Antras | 2019-08-16T08:25:40 | Change the struct parameter from a tt to a path.
This allows name paths with :: to be passed in. | diff --git a/src/offset_of.rs b/src/offset_of.rs
index b8e0dfe..0346dce 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -24,7 +24,7 @@
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__let_base_ptr {
- ($name:ident, $type:tt) => {
+ ($name:ident, $type:path) => {
// No UB here, and the p... | 2 | 27 | 15 |
f393002504e7a21e092e95ad2f3b0b710efa30f8 | Maarten de Vries | 2019-08-28T13:45:59 | Update library documentation to reflect removal of const implementation. | diff --git a/src/lib.rs b/src/lib.rs
index 4a97ee6..ac3f746 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,11 +20,10 @@
//! A crate used for calculating offsets of struct members and their spans.
//!
-//! Some of the funcationality of the crate makes no sense when used along with structs that
+//! Some of the func... | 1 | 2 | 3 |
28021da8ecc86f3132e605bfd85848fd29831a4a | Ralf Jung | 2019-08-10T13:11:59 | explain why we do not have deref coercion problems | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 6b3f2bd..b8e0dfe 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -85,6 +85,8 @@ macro_rules! offset_of {
_memoffset__let_base_ptr!(base_ptr, $parent);
// Get the field address. This is UB because we are creating a reference to
// ... | 1 | 2 | 0 |
b8d3d2d1316eb333525f843aa082538e545e70e5 | Ralf Jung | 2019-07-15T16:38:02 | use local_inner_macros | diff --git a/src/offset_of.rs b/src/offset_of.rs
index a1300af..82a90d2 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -23,7 +23,7 @@
#[cfg(memoffset_maybe_uninit)]
#[macro_export]
#[doc(hidden)]
-macro_rules! let_base_ptr {
+macro_rules! _memoffset__let_base_ptr {
($name:ident, $type:tt) => {
... | 2 | 29 | 19 |
b26ea242f3a8c2fba99e5e5733b38ae6c5ea78c7 | Ralf Jung | 2019-07-14T07:19:18 | explain let_base_ptr | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 98e7644..a1300af 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -26,6 +26,10 @@
macro_rules! let_base_ptr {
($name:ident, $type:tt) => {
// No UB here, and the pointer does not dangle, either.
+ // But we have to make sure that `unini... | 1 | 4 | 0 |
1783d533f304544d4013f73dd2b9360e8c09f03b | Ralf Jung | 2019-07-13T23:19:05 | old rust compat | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 733df5c..98e7644 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -76,10 +76,10 @@ macro_rules! field_check {
#[macro_export]
macro_rules! offset_of {
($parent:tt, $field:tt) => {{
- $crate::field_check!($parent, $field);
+ field_check!(... | 2 | 14 | 14 |
c332f10a247eb48fcf79a2083d82e88246fa9db6 | Ralf Jung | 2019-07-13T23:10:18 | improve doctest | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 921c7b5..8c8279d 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -76,7 +76,7 @@ macro_rules! field_check {
#[macro_export]
macro_rules! offset_of {
($parent:tt, $field:tt) => {{
- field_check!($parent, $field);
+ $crate::field_check!($p... | 2 | 19 | 15 |
6b03fc34b62a868e7375ae427bc6d2c13fc91a53 | Ralf Jung | 2019-07-13T22:58:23 | span_of: test packed and not-packed separately; not-packed passes on Miri | diff --git a/src/span_of.rs b/src/span_of.rs
index 7a21e90..c06330d 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -148,33 +148,48 @@ macro_rules! span_of {
mod tests {
use core::mem;
- #[repr(C, packed)]
- struct Foo {
- a: u32,
- b: [u8; 4],
- c: i64,
+ #[test]
+ fn span_... | 1 | 26 | 11 |
18860381cdcbda63d3f8b36f0a63f254f787047e | Ralf Jung | 2019-07-13T22:15:33 | deref coercion protection for span_of | diff --git a/src/lib.rs b/src/lib.rs
index 6bfc622..61fc587 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -40,7 +40,7 @@
//! fn main() {
//! assert_eq!(offset_of!(HelpMeIAmTrappedInAStructFactory, a), 15);
//! assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, a), 15..19);
-//! assert_eq!(span_of!(HelpM... | 3 | 45 | 56 |
ad161aca5414cf5f37d5688686ea614f1433e2fd | Ralf Jung | 2019-07-13T15:23:47 | field_check macro; propagate parent type through span_of | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 439c15d..aa8c222 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -42,6 +42,18 @@ macro_rules! let_base_ptr {
}
}
+/// Deref-coercion protection macro.
+#[macro_export]
+#[doc(hidden)]
+macro_rules! field_check {
+ ($type:tt, $field:tt) => {
+ ... | 2 | 34 | 25 |
b1051ccce98b867d92a08ec5d0bc06507e12d0f5 | Ralf Jung | 2019-07-13T15:18:07 | use the same base_ptr macro for span_of | diff --git a/src/span_of.rs b/src/span_of.rs
index de1a3e2..7741b4b 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -77,90 +77,44 @@
/// assert_eq!(0..42, span_of!(Blarg, x .. y[34]));
/// assert_eq!(0..64, span_of!(Blarg, x ..= y));
/// assert_eq!(58..68, span_of!(Blarg, y[50] ..= z));
-/... | 1 | 18 | 63 |
ae01598991259e383040009a3c957163c4f2305a | Ralf Jung | 2019-07-13T15:08:50 | share the common code between the two offset_of implementations | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 7012958..439c15d 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -18,6 +18,30 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+/// Macro to create a local `base_ptr` raw pointer of the given type, avoidin... | 1 | 28 | 32 |
e4c2fe6edd55b9fd9ed215b1700b3778f6e99168 | Ralf Jung | 2019-07-07T09:29:31 | offset_of: test packed and not-packed separately; not-packed passes on Miri | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 6931748..7012958 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -89,25 +89,41 @@ macro_rules! offset_of {
#[cfg(test)]
mod tests {
- #[repr(C, packed)]
- struct Foo {
- a: u32,
- b: [u8; 4],
- c: i64,
- }
-
#[test]
... | 1 | 24 | 8 |
45e4b2763e83253d14851816dcded14dbf48ea78 | Ralf Jung | 2019-07-07T09:01:31 | try to fix old macro | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 0d6e238..6931748 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -79,7 +79,7 @@ macro_rules! offset_of {
// See above for a better version that only works with newer Rust.
let non_null = $crate::ptr::NonNull::<$parent>::dangling();
... | 1 | 1 | 1 |
b47902ae68f64ebba4827a71ec7a1347a5949807 | Ralf Jung | 2019-07-07T08:48:48 | switch to nicer deref-coercion-protection; make two macros more similar | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 82d7397..0d6e238 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -43,32 +43,46 @@
#[macro_export]
#[cfg(memoffset_maybe_uninit)]
macro_rules! offset_of {
- ($parent:tt, $field:tt) => (unsafe {
+ ($parent:tt, $field:tt) => {{
+ // Make sure t... | 1 | 25 | 11 |
31a8de9c2f9b096352c4df3877aa8d3df5b73d07 | Gilad Naaman | 2019-07-02T17:56:30 | Fixed soundness issues and removed nested member access. | diff --git a/build.rs b/build.rs
index 57e9afd..1d885ba 100644
--- a/build.rs
+++ b/build.rs
@@ -6,7 +6,7 @@ fn main() {
assert!(version().unwrap().major >= 1);
// Check for a minimum version
- if version().unwrap() >= Version::parse("1.33.0").unwrap() {
- println!("cargo:rustc-cfg=memoffset_const... | 5 | 21 | 81 |
9e0690728594fa469de5914af8091480f18ed892 | Unknown | 2019-03-13T06:41:22 | Remove arbitrary expr | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 809b2ea..d15f6d6 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -20,12 +20,6 @@
/// Calculates the offset of the specified field from the start of the struct.
/// This macro supports arbitrary amount of subscripts and recursive member-accesses.
-///
-... | 2 | 35 | 101 |
b243bc1e89fc17892608ad36ec6c6f51c6b72ab8 | Unknown | 2019-03-13T05:37:47 | Support const expr (but not const fns) and arbitrary expressions
Parse `expr`s using lambda like syntax to avoid recursion. | diff --git a/src/lib.rs b/src/lib.rs
index 2738be4..e6d7487 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,6 +22,9 @@
//!
//! Some of the funcationality of the crate makes no sense when used along with structs that
//! are not `#[repr(C, packed)]`, but it is up to the user to make sure that they are.
+//!
+//! Thi... | 3 | 125 | 56 |
0437fd69c1de4c1f97d8cf449e6d510168cb8838 | Josh Stone | 2018-09-07T22:40:11 | Add #[allow(const_err)] on test offset_index_out_of_bounds
The compiler now raises a deny-by-default `const_err` lint on this test,
which doesn't let it get to the expected `#[should_panic]`. We can
allow that lint in order to let the test hit the error it wants. | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 6148657..1c981c2 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -105,6 +105,7 @@ mod tests {
#[test]
#[should_panic]
+ #[allow(const_err)]
fn offset_index_out_of_bounds() {
offset_of!(Foo, b[4]);
} | 1 | 1 | 0 |
468249a0699d1009cbd4844ea20e96eae9fa306f | Gilad Naaman | 2018-01-15T21:32:02 | Fixed unsafe/packing related warnings | diff --git a/Cargo.toml b/Cargo.toml
index 9d1bf42..81e1c6e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "memoffset"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
description = "offset_of functionality for Rust structs."
license = "MIT"
diff ... | 2 | 6 | 2 |
3faf5369447624e4cbf619403f0670fd93772d7f | Jeehoon Kang | 2018-01-13T14:13:21 | Support Rust 1.12.1 | diff --git a/src/span_of.rs b/src/span_of.rs
index f1cb509..e9125dd 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -132,7 +132,7 @@ macro_rules! span_of {
#[cfg(test)]
mod tests {
- use ::*;
+ use std::mem;
#[repr(C, packed)]
struct Foo { | 1 | 1 | 1 |
8f0b20382e6a8fc68d055864a6e6b64981a1a82f | Gilad Naaman | 2017-10-17T17:20:29 | Doc: Fixed incorrect calim about "..=" | diff --git a/src/lib.rs b/src/lib.rs
index e12be8e..89f5bf2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -62,11 +62,11 @@
#[cfg(feature = "std")]
#[doc(hidden)]
-pub use std::{mem, ptr};
+pub use std::mem;
#[cfg(not(feature = "std"))]
#[doc(hidden)]
-pub use core::{mem, ptr};
+pub use core::mem;
#[macro_use]
... | 2 | 2 | 5 |
16fca9241f708ca2bd8f77ae4b415ae4041fdd08 | Gilad Naaman | 2017-10-17T06:04:17 | doc+disclaimer | diff --git a/src/span_of.rs b/src/span_of.rs
index 8d1c64e..f1cb509 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -37,9 +37,18 @@
/// span_of!(Struct, member_a .. member_b)
/// // Inclusive
/// span_of!(Struct, member_a ..= member_b)
+///
+/// // Open-ended ranges
+/// span_of!(Struct, .. end)
+/// span_of!(St... | 1 | 10 | 1 |
e96f43aa328bdc5cea6f6accc6e39d0e5d371553 | Gilad Naaman | 2017-10-17T06:00:53 | RustFmt run | diff --git a/src/lib.rs b/src/lib.rs
index b15b21e..e12be8e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,7 +22,7 @@
//!
//! Some of the funcationality of the crate makes no sense when used along with structs that
//! are not `#[repr(C, packed)]`, but it is up to the user to make sure that they are.
-//!
+//!
//... | 3 | 81 | 51 |
14acc5cb2991923f63f68a90e5fe69efffe5f72e | Gilad Naaman | 2017-10-17T05:50:12 | Improved span_of! implementation | diff --git a/src/span_of.rs b/src/span_of.rs
index 86a1cb5..f1004ae 100644
--- a/src/span_of.rs
+++ b/src/span_of.rs
@@ -33,15 +33,12 @@
/// The general pattern of this form is:
///
/// ```ignore
+/// // Exclusive
/// span_of!(Struct, member_a .. member_b)
+/// // Inclusive
+/// span_of!(Struct, member_a ..= member... | 1 | 113 | 31 |
fc9c50ca3f63de95bcf16e5da81a26f849ace5f8 | Gilad Naaman | 2017-10-17T05:41:26 | Switched back into using uninitialized memory instead of nullptr | diff --git a/src/offset_of.rs b/src/offset_of.rs
index 23c3047..ee7bcf9 100644
--- a/src/offset_of.rs
+++ b/src/offset_of.rs
@@ -67,10 +67,12 @@
#[macro_export]
macro_rules! offset_of {
($father:ty, $($field:tt)+) => ({
- let root: *const $father = $crate::ptr::null();
+ let root: $father = unsafe ... | 2 | 14 | 10 |
32cbbb79ac89e35989be353eb4a99dcae2f37c7b | Gilad Naaman | 2017-10-16T03:22:58 | Changed name offset->memoffset | diff --git a/Cargo.toml b/Cargo.toml
index ca2da7e..e6f60db 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,9 @@
[package]
-name = "offset"
+name = "memoffset"
version = "0.1.0"
authors = ["Gilad Naaman <gilad.naaman@gmail.com>"]
+description="offset_of functionality for Rust structs."
+license="Apache-2.0"
[... | 2 | 15 | 6 |
4735a0b84085496b33d25037d2ec33eaa19f988b | Casper Meijn | 2024-08-19T06:49:08 | Specify patch version for `target-lexicon` (#72) | diff --git a/Cargo.toml b/Cargo.toml
index 2a2a3af..4197ebf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ targets = ["target-lexicon"]
[dependencies]
smallvec = "1.8"
-target-lexicon = { version = "0.12.11", optional = true }
+target-lexicon = { version = "0.12.15", optional = true }
[dev-dependenci... | 1 | 1 | 1 |
8b78a7c8f6f6659b6534b1295137ff5ef2e19930 | Jake Shadle | 2024-07-29T08:37:12 | Fix comment | diff --git a/src/expr.rs b/src/expr.rs
index b734141..30d0c9f 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -614,7 +614,7 @@ impl Expression {
{
let mut result_stack = SmallVec::<[T; 8]>::new();
- // We store the expression as postfix, so just evaluate each license
+ // We store the expres... | 1 | 1 | 1 |
9e04098241ba2a46b51af524af9487ffcc38b0ff | Jake Shadle | 2024-02-09T06:59:49 | Update to 1.76.0 (#67)
* Remove xcrun hack
https://github.com/rust-lang/rust/issues/36156 was apparently resolved years ago, so the hack is no longer needed
* Fixup update script
1.76.0 introduced a few new target keys, but they are experimental and thus not worth supporting until/if they are stabilized.
A... | diff --git a/src/expr.rs b/src/expr.rs
index faf8916..21d079d 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -540,7 +540,7 @@ impl Expression {
/// Evaluates the expression, using the provided closure to determine the value of
/// each predicate, which are then combined into a final result depending on the
-... | 7 | 140 | 99 |
ab22574f8a3dd9f86a892654810eb43b4a584628 | Rain | 2023-06-19T15:59:56 | Fix target_os = "none" parsing (#61) | diff --git a/src/expr.rs b/src/expr.rs
index 2e1aa01..3d76111 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -79,7 +79,12 @@ impl TargetMatcher for targ::TargetInfo {
},
Family(fam) => self.families.contains(fam),
HasAtomic(has_atomic) => self.has_atomics.contains(*has_atomic),
- ... | 2 | 12 | 1 |
9e5b68bc22989e69622b603a1daf70944c8b95d4 | Rain | 2022-11-05T08:47:24 | Update targets for Rust 1.65 (#53)
* Update targets for Rust 1.65
Also include target-lexicon updates and fixes.
* Fix clippy issues on Rust 1.65 | diff --git a/Cargo.toml b/Cargo.toml
index 8479229..31ca78a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ targets = ["target-lexicon"]
[dependencies]
smallvec = "1.8"
-target-lexicon = { version = "0.12.4", optional = true }
+target-lexicon = { version = "0.12.5", optional = true }
[dev-dependencies... | 6 | 68 | 15 |
9febdd3c2e7d021fe8e7e0d24cb43ab8ac6fb9c7 | Rain | 2022-05-26T08:40:11 | Update targets to Rust 1.61 (#50) | diff --git a/Cargo.toml b/Cargo.toml
index cf950e0..b2b671e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ targets = ["target-lexicon"]
[dependencies]
smallvec = "1.8"
-target-lexicon = { version = "0.12.3", optional = true }
+target-lexicon = { version = "0.12.4", optional = true }
[dev-dependencies... | 3 | 16 | 28 |
21a11765de207858cba1db626ffdf3993564c666 | Jake Shadle | 2022-02-25T10:52:16 | Update to Rust 1.59.0 (#48)
* Update to Rust 1.59.0
* Oops
* Remove unneeded workaround | diff --git a/src/targets.rs b/src/targets.rs
index 8ad214f..a6d6153 100644
--- a/src/targets.rs
+++ b/src/targets.rs
@@ -257,7 +257,7 @@ pub fn get_builtin_target_by_triple(triple: &str) -> Option<&'static TargetInfo>
/// versions.
///
/// ```
-/// assert_eq!("1.58.0", cfg_expr::targets::rustc_version());
+/// asser... | 3 | 13 | 21 |
10031cc73e7accf30002634bbfa6ce1b75eadefd | Rain | 2022-02-01T06:24:12 | update builtin targets to Rust 1.58 (#42) | diff --git a/Cargo.toml b/Cargo.toml
index 0640e2e..1551de4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ targets = ["target-lexicon"]
[dependencies]
smallvec = "1.6"
-target-lexicon = { version = "0.12.2", optional = true }
+target-lexicon = { version = "0.12.3", optional = true }
[dev-dependencies... | 5 | 155 | 25 |
f8c59a8dccd034267c744d19fe8814ce1185a42b | Rain | 2021-09-10T08:24:18 | Update builtin targets to Rust 1.55 (#40) | diff --git a/src/targets.rs b/src/targets.rs
index 64b2147..42cb147 100644
--- a/src/targets.rs
+++ b/src/targets.rs
@@ -193,7 +193,7 @@ pub fn get_builtin_target_by_triple(triple: &str) -> Option<&'static TargetInfo>
/// versions.
///
/// ```
-/// assert_eq!("1.54.0", cfg_expr::targets::rustc_version());
+/// asser... | 2 | 12 | 2 |
64b460831e020dc108e111663a0a38c922241f9e | Rain | 2021-08-31T06:33:17 | update builtin targets to Rust 1.54.0 (#38)
* make the target-family enum a fully open universe
Rust 1.54 introduces the new WASM target family. More target families
might be added in the future, so make this enum open-ended like Arch, Os
and others.
* use builtin constants for target-lexicon matching
The b... | diff --git a/Cargo.toml b/Cargo.toml
index 6721f5b..264847c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ targets = ["target-lexicon"]
[dependencies]
smallvec = "1.6"
-target-lexicon = { version = "0.12.1", optional = true }
+target-lexicon = { version = "0.12.2", optional = true }
[dev-dependencies... | 7 | 132 | 86 |
11851d8e0f9a0b4d0f16843e39301fe8181f4495 | Rémi Lauzier | 2021-08-19T16:32:58 | Fix a clippy warnings (#37) | diff --git a/src/expr.rs b/src/expr.rs
index f92b7bf..4f7b2b0 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -530,7 +530,7 @@ impl Expression {
result_stack.pop().unwrap()
}
- /// The original string which has been parsed to produce this ['Expression`].
+ /// The original string which has been pars... | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.