Skip to content

Commit

Permalink
add 'static to un-boxing trait objects
Browse files Browse the repository at this point in the history
  • Loading branch information
maccesch committed Jul 13, 2023
1 parent 35f704a commit 12519b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "default-struct-builder"
version = "0.4.0"
version = "0.4.1"
edition = "2021"
authors = ["Marc-Stefan Cassola"]
description = "Generates builder methods of every field of a struct."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ trait Test {}

#[derive(DefaultBuilder)]
struct SomeOptions {
the_field: Box<dyn Test + 'static>,
the_field: Box<dyn Test>,
other_field: Box<String>,

#[builder(keep_box)]
Expand Down
2 changes: 1 addition & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl ToTokens for DefaultBuilderDeriveInput {

let boxed_inner_type = if let Type::TraitObject(obj) = boxed_inner_type {
let bounds = obj.bounds;
quote! { impl #bounds }
quote! { impl #bounds + 'static }
} else {
boxed_inner_type.to_token_stream()
};
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
//!
//! #[derive(DefaultBuilder)]
//! struct SomeOptions {
//! the_field: Box<dyn Test + 'static>,
//! the_field: Box<dyn Test>,
//! other_field: Box<String>,
//!
//! #[builder(keep_box)]
Expand All @@ -235,7 +235,7 @@
//! # trait Test {}
//! #
//! # struct SomeOptions {
//! # the_field: Box<dyn Test + 'static>,
//! # the_field: Box<dyn Test>,
//! # other_field: Box<String>,
//! # keep: Box<String>,
//! # }
Expand Down

0 comments on commit 12519b2

Please sign in to comment.