Skip to content

Commit 83c8f0d

Browse files
committed
glib: Make <Variant as HasParamSpec>::BuilderFn generic over lifetimes
1 parent a1a0fdc commit 83c8f0d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

glib-macros/tests/properties.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ mod foo {
9393
string_vec: RefCell<Vec<String>>,
9494
#[property(get, set, builder(glib::VariantTy::DOUBLE))]
9595
variant: RefCell<Option<glib::Variant>>,
96+
#[property(get, set, builder(&<Option<i32>>::static_variant_type()))]
97+
variant2: RefCell<Option<glib::Variant>>,
9698
#[property(get = |_| 42.0, set)]
9799
infer_inline_type: RefCell<f64>,
98100
// The following property doesn't store any data. The value of the property is calculated

glib/src/param_spec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,8 +2307,7 @@ has_simple_spec!(bool, ParamSpecBoolean, ParamSpecBooleanBuilder);
23072307
impl HasParamSpec for crate::Variant {
23082308
type ParamSpec = ParamSpecVariant;
23092309
type SetValue = Self;
2310-
type BuilderFn =
2311-
fn(&'static str, ty: &'static crate::VariantTy) -> ParamSpecVariantBuilder<'static>;
2310+
type BuilderFn = for<'a> fn(&'a str, ty: &'a crate::VariantTy) -> ParamSpecVariantBuilder<'a>;
23122311

23132312
fn param_spec_builder() -> Self::BuilderFn {
23142313
Self::ParamSpec::builder

0 commit comments

Comments
 (0)