Skip to content

Commit c678ad6

Browse files
committed
rename PropType to Property
1 parent a1bc01c commit c678ad6

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

glib-macros/src/props.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn expand_properties_fn(props: &[PropDesc]) -> TokenStream2 {
281281
let build_nick = nick.as_ref().map(|x| quote!(.nick(#x)));
282282
let build_blurb = blurb.as_ref().map(|x| quote!(.blurb(#x)));
283283
quote! {
284-
<<#ty as glib::PropType>::HasSpecType as glib::HasParamSpec>
284+
<<#ty as glib::Property>::Inner as glib::HasParamSpec>
285285
::ParamSpec
286286
::builder #builder_call
287287
#build_nick
@@ -406,11 +406,11 @@ fn expand_getset_properties_def(props: &[PropDesc]) -> TokenStream2 {
406406
let getter = p
407407
.get
408408
.is_some()
409-
.then(|| quote!(fn #ident(&self) -> <#ty as glib::PropType>::HasSpecType;));
409+
.then(|| quote!(fn #ident(&self) -> <#ty as glib::Property>::Inner;));
410410
let setter = p
411411
.set
412412
.is_some()
413-
.then(|| quote!(fn #set_ident(&self, value: <#ty as glib::PropType>::HasSpecType);));
413+
.then(|| quote!(fn #set_ident(&self, value: <#ty as glib::Property>::Inner);));
414414
quote!(
415415
#getter
416416
#setter
@@ -439,7 +439,7 @@ fn expand_getset_properties_impl(imp_type_ident: &syn::Ident, props: &[PropDesc]
439439
quote!((#custom_fn)(&self.imp()))
440440
}
441441
};
442-
quote!(fn #ident(&self) -> <#ty as glib::PropType>::HasSpecType {
442+
quote!(fn #ident(&self) -> <#ty as glib::Property>::Inner {
443443
#body
444444
})
445445
});
@@ -456,7 +456,7 @@ fn expand_getset_properties_impl(imp_type_ident: &syn::Ident, props: &[PropDesc]
456456
quote!((#custom_fn)(&self.imp(), value))
457457
}
458458
};
459-
quote!(fn #set_ident(&self, value: <#ty as glib::PropType>::HasSpecType) {
459+
quote!(fn #set_ident(&self, value: <#ty as glib::Property>::Inner) {
460460
#body
461461
})
462462
});

glib/src/props.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@ use crate::HasParamSpec;
1414
// rustdoc-stripper-ignore-next
1515
/// A type that can be used as a property. It covers every type which have an associated `ParamSpec`
1616
/// (`HasParamSpec`) and some useful types wrapping `HasParamSpec`.
17-
/// The definition is recursive, so you can nest many `PropType`s together. The final `ParamSpec` will
17+
/// The definition is recursive, so you can nest many `Property`s together. The final `ParamSpec` will
1818
/// be the one of the innermost type
19-
pub trait PropType {
20-
type HasSpecType;
19+
pub trait Property {
20+
type Inner: HasParamSpec;
2121
}
22-
impl<T: HasParamSpec> PropType for T {
23-
type HasSpecType = T;
22+
impl<T: HasParamSpec> Property for T {
23+
type Inner = T;
2424
}
25-
impl<T: PropType> PropType for Option<T> {
26-
type HasSpecType = T::HasSpecType;
25+
impl<T: Property> Property for Option<T> {
26+
type Inner = T::Inner;
2727
}
28-
impl<T: PropType> PropType for PhantomData<T> {
29-
type HasSpecType = T::HasSpecType;
28+
impl<T: Property> Property for PhantomData<T> {
29+
type Inner = T::Inner;
3030
}
31-
impl<T: PropType> PropType for RefCell<T> {
32-
type HasSpecType = T::HasSpecType;
31+
impl<T: Property> Property for RefCell<T> {
32+
type Inner = T::Inner;
3333
}
34-
impl<T: PropType> PropType for Cell<T> {
35-
type HasSpecType = T::HasSpecType;
34+
impl<T: Property> Property for Cell<T> {
35+
type Inner = T::Inner;
3636
}
37-
impl<T: PropType> PropType for Mutex<T> {
38-
type HasSpecType = T::HasSpecType;
37+
impl<T: Property> Property for Mutex<T> {
38+
type Inner = T::Inner;
3939
}
40-
impl<T: PropType> PropType for RwLock<T> {
41-
type HasSpecType = T::HasSpecType;
40+
impl<T: Property> Property for RwLock<T> {
41+
type Inner = T::Inner;
4242
}
43-
impl<T: PropType> PropType for Rc<T> {
44-
type HasSpecType = T::HasSpecType;
43+
impl<T: Property> Property for Rc<T> {
44+
type Inner = T::Inner;
4545
}
46-
impl<T: PropType> PropType for Arc<T> {
47-
type HasSpecType = T::HasSpecType;
46+
impl<T: Property> Property for Arc<T> {
47+
type Inner = T::Inner;
4848
}
49-
impl<T: PropType> PropType for OnceCell<T> {
50-
type HasSpecType = T::HasSpecType;
49+
impl<T: Property> Property for OnceCell<T> {
50+
type Inner = T::Inner;
5151
}
5252

5353
// rustdoc-stripper-ignore-next
@@ -112,7 +112,7 @@ impl<T> PropRead for OnceCell<T> {
112112
// `ParamStoreWrite` requires a function taking Self::Value, but OnceCell doesn't have
113113
// an internal value before being init. Still, I'm implementing it so that the derive `Props`
114114
// macro can easily work with it
115-
impl<T: PropType + Default> PropWrite for OnceCell<T> {
115+
impl<T: Property + Default> PropWrite for OnceCell<T> {
116116
type Value = T;
117117
fn set<F: FnOnce(&mut Self::Value)>(&self, f: F) {
118118
let mut v = Self::Value::default();

0 commit comments

Comments
 (0)