Registry / utility / field-offset

field-offset

JSON →
library0.3.6rscratesunverified

Safe pointer-to-member implementation for Rust, allowing field offset calculations.

# Cargo.toml [dependencies] field-offset = "0.3.6"
INSTALL
IMPORT
SIG · FIELD-OFFSET
F
field-offset
utilityrustv0.3.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

offset_of
use field_offset::offset_of;

Calculates the byte offset of a struct field using the offset_of! macro.

use field_offset::offset_of; struct Point { x: f64, y: f64 } fn main() { let offset = offset_of!(Point => x); println!("Offset of x: {}", offset); }
Debug
Known issues
gotchaThe offset_of! macro requires nightly Rust or the field_offset crate's feature flags.
fix
Enable the "unstable" feature if using stable Rust, or switch to nightly.
affects: >=0.3.6
Upgrade
Version history
0.3.6latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
field-offset — cargo add field-offset · libregistry