Giter Club home page Giter Club logo

repr_offset_crates's Introduction

Rust crates-io api-docs

repr_offset allows computing and safely using field offsets from types with a defined layout.

Currently only #[repr(C)]/#[repr(C,packed)]/#[repr(C,align)] structs are supported.

Features

These are some of the features this library provides:

  • The ReprOffset derive macro, which outputs associated constants with the offsets of fields, and implements the GetFieldOffset trait for each field.

  • The FieldOffset type (how offsets are represented), with methods for operating on a field through a pointer to the struct, including getting a reference(or pointer) to the field.

  • The unsafe_struct_field_offsets macro as an alternative to the ReprOffset derive macro, most useful when the "derive" feature is disabled.

  • The GetFieldOffset trait, for getting the FieldOffset for a field, and the OFF!, off, PUB_OFF!, and pub_off macros for getting the FieldOffset for a field with a convenient syntax.

  • The extension traits from the ext module, which define methods for operating on a field, given a FieldOffset.

Examples

For examples you can look at the examples section of the documentation for the root module of the repr_offset crate

Future plans

None for now.

Cargo features

These are the cargo features in repr_offset:

  • derive (disabled by default): Enables the ReprOffset derive macro. This requires the same Rust versions as syn, which is currently >= 1.56.0.

  • "for_examples" (disabled by default): Enables the for_examples module, with types used in documentation examples.

Adding the "derive" feature to the Cargo.toml file:

repr_offset = { version = "0.2", features = ["derive"] }

no-std support

This library is unconditionally #![no_std],and that is unlikely to change in the future.

Minimum Rust version

This crate support Rust back to 1.41.0.

License

Licensed under the Zlib license

repr_offset_crates's People

Contributors

rodrimati1992 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

zirconium-n

repr_offset_crates's Issues

Future incompatible warning on repr_offset v0.2.1

While compiling stable_abi, I got this warning.

Warning: the following packages contain code that will be rejected by a future version of Rust: repr_offset v0.2.1
note: 
To solve this problem, you can try the following approaches:


- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - [email protected]
  - Repository: https://github.com/rodrimati1992/repr_offset_crates/
  - Detailed warning command: `cargo report future-incompatibilities --id 2 --package [email protected]`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

rustc version: rustc 1.69.0-nightly (246eae2fa 2023-02-21)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.