into_inner
A simple trait and derive macro for extracting the inner value from tuple structs (newtypes) with a single field.
Overview
The into_inner crate provides the IntoInner trait and a convenient #[derive(IntoInner)] macro for tuple structs with exactly one field. This allows you to easily extract the wrapped value from your newtypes without boilerplate.
Usage
Add this to your Cargo.toml:
[]
= "0.1"
Then, in your code:
use IntoInner;
;
let wrapper = MyWrapper;
let inner = wrapper.into_inner;
assert_eq!;
Features
- Derive macro for tuple structs with a single field.
- Compile-time errors for unsupported struct types.
- No dependencies outside of proc-macro ecosystem.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Contribution
Contributions are welcome! Please open issues or pull requests on GitLab.
See Also
- into_inner_derive — the procedural macro implementation.