Skip to content

Commit

Permalink
Merge pull request #42 from rust-amplify/wrapper
Browse files Browse the repository at this point in the history
Wrapper improvements
  • Loading branch information
dr-orlovsky authored Oct 9, 2023
2 parents a21c0b4 + 8b3cba9 commit 4192101
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 219 deletions.
6 changes: 3 additions & 3 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ array_width = 100
attr_fn_like_width = 100
fn_call_width = 100

format_code_in_doc_comments = true
format_code_in_doc_comments = false
fn_single_line = true
format_macro_matchers = true
format_macro_bodues = true
format_macro_bodies = true
format_strings = true
merge_derives = false
overflow_delimited_expr = true
reorder_modules = false
use_field_init_shorthand = true
use_try_shorthand = true
wrap_comments = true
wrap_comments = false
where_single_line = true
unstable_features = true
empty_item_single_line = true
Expand Down
120 changes: 64 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,13 @@ pub fn derive_getters(input: TokenStream) -> TokenStream {
/// * `amplify::Wrapper`
/// * [`AsRef`]
/// * [`core::borrow::Borrow`]
/// You may skip `AsRef` and `Borrow` implementations with `#[wrapper(NoRefs)]`.
///
/// You can implement additional derives, it they are implemented for the
/// wrapped type, using `#[wrapper()]` proc macro:
/// 1. Reference access to the inner type:
/// * `Deref` for implementing [`core::ops::Deref`]
/// * `AsSlice` for implementing [`AsRef`]`<[u8]>`
/// * `BorrowSlice` for implementing
/// [`core::borrow::Borrow`]`<[Self::Inner]>`
/// 2. Formatting:
Expand Down Expand Up @@ -775,11 +777,14 @@ pub fn derive_wrapper(input: TokenStream) -> TokenStream {
/// * `amplify::WrapperMut`
/// * [`AsMut`]
/// * [`core::borrow::BorrowMut`]
/// You may skip `AsMut` and `BorrowMut` implementations with
/// `#[wrapper_mut(NoRefs)]`.
///
/// You can implement additional derives, it they are implemented for the
/// wrapped type, using `#[wrapper()]` proc macro:
/// 1. Reference access to the inner type:
/// * `DerefMut` for implementing [`core::ops::DerefMut`]
/// * `AsSliceMut` for implementing [`AsMut`]`<[u8]>`
/// * `BorrowSliceMut` for implementing
/// [`core::borrow::BorrowMut`]`<[Self::Inner]>`
/// 2. Indexed access to the inner type:
Expand Down Expand Up @@ -832,7 +837,7 @@ pub fn derive_wrapper(input: TokenStream) -> TokenStream {
/// Display
/// )]
/// #[display(inner)]
/// #[wrapper(NumberFmt, MathOps, BoolOps)]
/// #[wrapper(NumberFmt, MathOps, BoolOps, FromStr)]
/// #[wrapper_mut(MathAssign, BitAssign)]
/// struct Int64(i64);
/// ```
Expand Down
Loading

0 comments on commit 4192101

Please sign in to comment.