thinwrap 1.0.0

Deref struct macros for Rust
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented0 out of 0 items with examples
  • Size
  • Source code size: 38.96 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.57 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ewpratten

ThinWrap

Crates.io Build

ThinWrap is a very small Rust library that provides a macro (thin_wrap!) to wrap any struct in an outer struct, and generate its Deref and DerefMut traits automatically.

Example

With ThinWrap:

pub struct Inner;

thin_wrap!(pub, Outer, Inner);

Without ThinWrap:

pub struct Inner;

pub struct Outer(Inner);

impl Deref for Outer {
    type Target = Inner;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl DerefMut for Outer {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}