| 1 | // Take a look at the license at the top of the repository in the LICENSE file. |
| 2 | |
| 3 | use glibrust-analyzer cargo glib 0.22.5 crate/::ParamFlagsrust-analyzer cargo glib 0.22.5 gobject/flags/ParamFlags#; |
| 4 | use glibrust-analyzer cargo glib 0.22.5 crate/::preluderust-analyzer cargo glib 0.22.5 prelude/::*; |
| 5 | |
| 6 | #[cfg(test)] |
| 7 | mod baserust-analyzer cargo glib-macros 0.22.6 base/ { |
| 8 | use glibrust-analyzer cargo glib 0.22.5 crate/::preluderust-analyzer cargo glib 0.22.5 prelude/::*; |
| 9 | use glibrust-analyzer cargo glib 0.22.5 crate/::subclassrust-analyzer cargo glib 0.22.5 subclass/::preluderust-analyzer cargo glib 0.22.5 subclass/prelude/::*; |
| 10 | use glib_macrosrust-analyzer cargo glib-macros 0.22.6 crate/::Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:; |
| 11 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 12 | |
| 13 | pub mod imprust-analyzer cargo glib-macros 0.22.6 base/imp/ { |
| 14 | use superrust-analyzer cargo glib-macros 0.22.6 base/::*; |
| 15 | |
| 16 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 17 | #[properties(wrapper_type = superrust-analyzer cargo glib-macros 0.22.6 base/::Baserust-analyzer cargo glib-macros 0.22.6 base/Base#, ext_trait)] |
| 18 | pub struct Baserust-analyzer cargo glib-macros 0.22.6 base/imp/Base# { |
| 19 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get = Selfrust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base][DerivedObjectProperties]::not_overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base]not_overridden().)] |
| 20 | overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/Base#overridden.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<u32>, |
| 21 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get = Selfrust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base][DerivedObjectProperties]::not_overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base]not_overridden().)] |
| 22 | not_overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/Base#not_overridden.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<u32>, |
| 23 | } |
| 24 | |
| 25 | #[glibrust-analyzer cargo glib 0.22.5 crate/::derived_propertiesrust-analyzer cargo glib-macros 0.22.2 derived_properties:] |
| 26 | impl ObjectImplrust-analyzer cargo glib 0.22.5 subclass/object/ObjectImpl# for Baserust-analyzer cargo glib-macros 0.22.6 base/imp/Base# {} |
| 27 | |
| 28 | #[glibrust-analyzer cargo glib 0.22.5 crate/::object_subclassrust-analyzer cargo glib-macros 0.22.2 object_subclass:] |
| 29 | impl ObjectSubclassrust-analyzer cargo glib 0.22.5 subclass/types/ObjectSubclass# for Baserust-analyzer cargo glib-macros 0.22.6 base/imp/Base# { |
| 30 | const NAMErust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base][ObjectSubclass]NAME.: &'static str = "MyBase"; |
| 31 | type Typerust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base][ObjectSubclass]Type# = superrust-analyzer cargo glib-macros 0.22.6 base/::Baserust-analyzer cargo glib-macros 0.22.6 base/Base#; |
| 32 | } |
| 33 | |
| 34 | impl Baserust-analyzer cargo glib-macros 0.22.6 base/imp/Base# { |
| 35 | fn not_overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/impl#[Base]not_overridden().(&self) -> u32 { |
| 36 | 42 |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | glibrust-analyzer cargo glib 0.22.5 crate/::wrapperrust-analyzer cargo glib 0.22.5 wrapper/wrapper!! { |
| 42 | pub struct Baserust-analyzer cargo glib-macros 0.22.6 base/Base#(ObjectSubclass<imprust-analyzer cargo glib-macros 0.22.6 base/imp/::Baserust-analyzer cargo glib-macros 0.22.6 base/imp/Base#>); |
| 43 | } |
| 44 | |
| 45 | unsafe impl<T: ObjectImplrust-analyzer cargo glib 0.22.5 subclass/object/ObjectImpl#> IsSubclassablerust-analyzer cargo glib 0.22.5 subclass/types/IsSubclassable#<T> for Baserust-analyzer cargo glib-macros 0.22.6 base/Base# {} |
| 46 | } |
| 47 | |
| 48 | #[cfg(test)] |
| 49 | mod foorust-analyzer cargo glib-macros 0.22.6 foo/ { |
| 50 | use glibrust-analyzer cargo glib 0.22.5 crate/::preluderust-analyzer cargo glib 0.22.5 prelude/::*; |
| 51 | use glibrust-analyzer cargo glib 0.22.5 crate/::subclassrust-analyzer cargo glib 0.22.5 subclass/::preluderust-analyzer cargo glib 0.22.5 subclass/prelude/::*; |
| 52 | use glib_macrosrust-analyzer cargo glib-macros 0.22.6 crate/::{Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:, ValueDelegaterust-analyzer cargo glib-macros 0.22.6 ValueDelegate:}; |
| 53 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#; |
| 54 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#; |
| 55 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 56 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#; |
| 57 | |
| 58 | use superrust-analyzer cargo glib-macros 0.22.6 crate/::baserust-analyzer cargo glib-macros 0.22.6 base/::Baserust-analyzer cargo glib-macros 0.22.6 base/Base#; |
| 59 | |
| 60 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(ValueDelegaterust-analyzer cargo glib-macros 0.22.6 ValueDelegate:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 61 | pub struct MyPropertyValuerust-analyzer cargo glib-macros 0.22.6 foo/MyPropertyValue#(pub i32); |
| 62 | |
| 63 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, glibrust-analyzer cargo glib 0.22.5 crate/::Boxedrust-analyzer cargo glib-macros 0.22.2 Boxed:)] |
| 64 | #[boxed_type(name = "SimpleBoxedString")] |
| 65 | pub struct SimpleBoxedStringrust-analyzer cargo glib-macros 0.22.6 foo/SimpleBoxedString#(pub Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#); |
| 66 | |
| 67 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, glibrust-analyzer cargo glib 0.22.5 crate/::Enumrust-analyzer cargo glib-macros 0.22.2 Enum:)] |
| 68 | #[enum_type(name = "SimpleEnum")] |
| 69 | pub enum SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum# { |
| 70 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 71 | Onerust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#One#, |
| 72 | Tworust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#Two#, |
| 73 | } |
| 74 | |
| 75 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 76 | struct Authorrust-analyzer cargo glib-macros 0.22.6 foo/Author# { |
| 77 | namerust-analyzer cargo glib-macros 0.22.6 foo/Author#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 78 | nickrust-analyzer cargo glib-macros 0.22.6 foo/Author#nick.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 79 | } |
| 80 | |
| 81 | pub mod imprust-analyzer cargo glib-macros 0.22.6 foo/imp/ { |
| 82 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#, rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/::Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#}; |
| 83 | |
| 84 | use superrust-analyzer cargo glib-macros 0.22.6 foo/::*; |
| 85 | |
| 86 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 87 | #[properties(wrapper_type = superrust-analyzer cargo glib-macros 0.22.6 foo/::Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo#)] |
| 88 | pub struct Foorust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo# { |
| 89 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 90 | barrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#bar.: Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 91 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 92 | doublerust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#double.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<f64>, |
| 93 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 94 | string_vecrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#string_vec.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>, |
| 95 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, builder(glibrust-analyzer cargo glib 0.22.5 crate/::VariantTyrust-analyzer cargo glib 0.22.5 variant_type/VariantTy#::DOUBLErust-analyzer cargo glib 0.22.5 variant_type/impl#[VariantTy]DOUBLE.))] |
| 96 | variantrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#variant.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<glibrust-analyzer cargo glib 0.22.5 crate/::Variantrust-analyzer cargo glib 0.22.5 variant/Variant#>>, |
| 97 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, builder(&<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<i32>>::static_variant_typerust-analyzer cargo glib 0.22.5 variant/impl#[`Option<T>`][StaticVariantType]static_variant_type().()))] |
| 98 | variant2rust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#variant2.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<glibrust-analyzer cargo glib 0.22.5 crate/::Variantrust-analyzer cargo glib 0.22.5 variant/Variant#>>, |
| 99 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get = |_| 42.0, set)] |
| 100 | infer_inline_typerust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#infer_inline_type.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<f64>, |
| 101 | // The following property doesn't store any data. The value of the property is calculated |
| 102 | // when the value is accessed. |
| 103 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get = Selfrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][DerivedObjectProperties]::hello_worldrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]hello_world().)] |
| 104 | _buzzrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#_buzz.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 105 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 106 | my_property_valuerust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#my_property_value.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<MyPropertyValuerust-analyzer cargo glib-macros 0.22.6 foo/MyPropertyValue#>, |
| 107 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set = Selfrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][DerivedObjectProperties]::set_fizzrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]set_fizz()., name = "fizz", nickrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecBuilderExt#nick(). = "fizz-nick", |
| 108 | blurbrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecBuilderExt#blurb(). = "short description stored in the GLib type system" |
| 109 | )] |
| 110 | fizzrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#fizz.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 111 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(name = "author-name", get, set, type = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, member = namerust-analyzer cargo glib-macros 0.22.6 foo/Author#name.)] |
| 112 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(name = "author-nick", get, set, type = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, member = nickrust-analyzer cargo glib-macros 0.22.6 foo/Author#nick.)] |
| 113 | authorrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#author.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Authorrust-analyzer cargo glib-macros 0.22.6 foo/Author#>, |
| 114 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:( |
| 115 | type = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 116 | get = |t: &Selfrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][DerivedObjectProperties]| t.authorrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#author..borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]borrow().().namerust-analyzer cargo glib-macros 0.22.6 foo/Author#name..to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().(), |
| 117 | set = Selfrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][DerivedObjectProperties]::set_author_namerust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]set_author_name().)] |
| 118 | fake_fieldrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#fake_field.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 119 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get)] |
| 120 | read_only_textrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#read_only_text.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 121 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, explicit_notifyrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecBuilderExt#explicit_notify()., lax_validationrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecBuilderExt#lax_validation().)] |
| 122 | custom_flagsrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#custom_flags.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 123 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, default = "hello")] |
| 124 | with_defaultrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#with_default.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 125 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, builder())] |
| 126 | simple_builderrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#simple_builder.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<u32>, |
| 127 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, builder().minimumrust-analyzer cargo glib 0.22.5 param_spec/impl#[`ParamSpecUIntBuilder<'a>`]minimum().(0).maximumrust-analyzer cargo glib 0.22.5 param_spec/impl#[`ParamSpecUIntBuilder<'a>`]maximum().(5))] |
| 128 | numeric_builderrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#numeric_builder.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<u32>, |
| 129 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, minimumrust-analyzer cargo glib 0.22.5 param_spec/impl#[`ParamSpecUIntBuilder<'a>`]minimum(). = 0, maximumrust-analyzer cargo glib 0.22.5 param_spec/impl#[`ParamSpecUIntBuilder<'a>`]maximum(). = 5)] |
| 130 | builder_fields_without_builderrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#builder_fields_without_builder.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<u32>, |
| 131 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, builder('c'))] |
| 132 | builder_with_required_paramrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#builder_with_required_param.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<char>, |
| 133 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, default)] |
| 134 | char_defaultrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#char_default.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<char>, |
| 135 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 136 | boxedrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#boxed.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<SimpleBoxedStringrust-analyzer cargo glib-macros 0.22.6 foo/SimpleBoxedString#>, |
| 137 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, builder(SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#::Tworust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#Two#))] |
| 138 | fenumrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#fenum.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#>, |
| 139 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, default)] |
| 140 | fenum_defaultrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#fenum_default.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#>, |
| 141 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, nullable)] |
| 142 | objectrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#object.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<glibrust-analyzer cargo glib 0.22.5 crate/::Objectrust-analyzer cargo glib 0.22.5 object/Object#>>, |
| 143 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set, nullable)] |
| 144 | optionalrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#optional.: RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>, |
| 145 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 146 | smart_pointerrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#smart_pointer.: Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#<RefCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/RefCell#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>, |
| 147 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 148 | once_cellrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#once_cell.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<u8>, |
| 149 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 150 | cellrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#cell.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 151 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get = Selfrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][DerivedObjectProperties]::overriddenrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]overridden()., override_class = Baserust-analyzer cargo glib-macros 0.22.6 base/Base#)] |
| 152 | overriddenrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#overridden.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<u32>, |
| 153 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 154 | weak_ref_proprust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#weak_ref_prop.: glibrust-analyzer cargo glib 0.22.5 crate/::WeakRefrust-analyzer cargo glib 0.22.5 object/WeakRef#<glibrust-analyzer cargo glib 0.22.5 crate/::Objectrust-analyzer cargo glib 0.22.5 object/Object#>, |
| 155 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 156 | send_weak_ref_proprust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#send_weak_ref_prop.: glibrust-analyzer cargo glib 0.22.5 crate/::SendWeakRefrust-analyzer cargo glib 0.22.5 object/SendWeakRef#<glibrust-analyzer cargo glib 0.22.5 crate/::Objectrust-analyzer cargo glib 0.22.5 object/Object#>, |
| 157 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, default_valuerust-analyzer cargo glib 0.22.5 param_spec/impl#[`ParamSpecUIntBuilder<'a>`]default_value(). = 0, construct_onlyrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecBuilderExt#construct_only().)] |
| 158 | construct_only_cellrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#construct_only_cell.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<u32>, |
| 159 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set = Selfrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][DerivedObjectProperties]::set_construct_only_customrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]set_construct_only_custom()., construct_onlyrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecBuilderExt#construct_only().)] |
| 160 | construct_only_custom_setterrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#construct_only_custom_setter.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>, |
| 161 | } |
| 162 | |
| 163 | #[glibrust-analyzer cargo glib 0.22.5 crate/::object_subclassrust-analyzer cargo glib-macros 0.22.2 object_subclass:] |
| 164 | impl ObjectSubclassrust-analyzer cargo glib 0.22.5 subclass/types/ObjectSubclass# for Foorust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo# { |
| 165 | const NAMErust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][ObjectSubclass]NAME.: &'static str = "MyFoo"; |
| 166 | type Typerust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][ObjectSubclass]Type# = superrust-analyzer cargo glib-macros 0.22.6 foo/::Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo#; |
| 167 | type ParentTyperust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo][ObjectSubclass]ParentType# = Baserust-analyzer cargo glib-macros 0.22.6 base/Base#; |
| 168 | } |
| 169 | |
| 170 | #[glibrust-analyzer cargo glib 0.22.5 crate/::derived_propertiesrust-analyzer cargo glib-macros 0.22.2 derived_properties:] |
| 171 | impl ObjectImplrust-analyzer cargo glib 0.22.5 subclass/object/ObjectImpl# for Foorust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo# {} |
| 172 | |
| 173 | impl Foorust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo# { |
| 174 | fn set_author_namerust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]set_author_name().(&self, value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 175 | self.authorrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#author..borrow_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]borrow_mut().().namerust-analyzer cargo glib-macros 0.22.6 foo/Author#name. = value; |
| 176 | } |
| 177 | fn hello_worldrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]hello_world().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 178 | Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("Hello world!") |
| 179 | } |
| 180 | fn set_fizzrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]set_fizz().(&self, value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 181 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefMut<'_, T>`][DerefMut]deref_mut().self.fizzrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#fizz..borrow_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`RefCell<T>`]borrow_mut().() = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("custom set: {value}"); |
| 182 | } |
| 183 | fn overriddenrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]overridden().(&self) -> u32 { |
| 184 | 43 |
| 185 | } |
| 186 | fn set_construct_only_customrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[Foo]set_construct_only_custom().(&self, value: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>) { |
| 187 | self.construct_only_custom_setterrust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#construct_only_custom_setter. |
| 188 | .setrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]set().(value.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|v| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("custom set: {v}"))) |
| 189 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Setter to be only called once"); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /// Checks that `Properties` does not pollute the scope with |
| 194 | /// trait imports, as it did in older versions. |
| 195 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 196 | fn no_import_leaksrust-analyzer cargo glib-macros 0.22.6 foo/imp/no_import_leaks().() { |
| 197 | // `vec.get` can match these methods (in order of precedence): |
| 198 | // (1) `<Vec<String> as PropertyGet>::get` |
| 199 | // (2) `<[String]>::get` through deref of `Vec<String>` |
| 200 | // Had the macro introduced `PropertyGet` into the scope, it would |
| 201 | // resolve to (1), which we do not want. |
| 202 | let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); 2]; |
| 203 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(vec.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(1), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().())); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | glibrust-analyzer cargo glib 0.22.5 crate/::wrapperrust-analyzer cargo glib 0.22.5 wrapper/wrapper!! { |
| 208 | pub struct Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo#(ObjectSubclass<imprust-analyzer cargo glib-macros 0.22.6 foo/imp/::Foorust-analyzer cargo glib-macros 0.22.6 foo/imp/Foo#>) @extends Baserust-analyzer cargo glib-macros 0.22.6 base/Base#; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 213 | fn propsrust-analyzer cargo glib-macros 0.22.6 props().() { |
| 214 | use craterust-analyzer cargo glib-macros 0.22.6 crate/::foorust-analyzer cargo glib-macros 0.22.6 foo/::SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#; |
| 215 | |
| 216 | let myfoo: foorust-analyzer cargo glib-macros 0.22.6 foo/::Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo# = glibrust-analyzer cargo glib 0.22.5 crate/::objectrust-analyzer cargo glib 0.22.5 object/::Objectrust-analyzer cargo glib 0.22.5 object/Object#::newrust-analyzer cargo glib 0.22.5 object/impl#[Object]new().(); |
| 217 | |
| 218 | // Read values |
| 219 | let bar: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("bar"); |
| 220 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bar, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 221 | let string_vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("string-vec"); |
| 222 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(string_vec.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()); |
| 223 | let my_property_value: foorust-analyzer cargo glib-macros 0.22.6 foo/::MyPropertyValuerust-analyzer cargo glib-macros 0.22.6 foo/MyPropertyValue# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("my-property-value"); |
| 224 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(my_property_value, foorust-analyzer cargo glib-macros 0.22.6 foo/::MyPropertyValuerust-analyzer cargo glib-macros 0.22.6 foo/MyPropertyValue#(0)); |
| 225 | let var: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<glibrust-analyzer cargo glib 0.22.5 crate/::Variantrust-analyzer cargo glib 0.22.5 variant/Variant#> = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("variant"); |
| 226 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(var.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 227 | |
| 228 | // Set values |
| 229 | myfoo.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("bar", "epic".to_valuerust-analyzer cargo glib 0.22.5 value/impl#[str][ToValue]to_value().()); |
| 230 | let bar: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("bar"); |
| 231 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bar, "epic".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 232 | myfoo.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("string-vec", ["epic", "more epic"].to_valuerust-analyzer cargo glib 0.22.5 value/impl#[`[&str]`][ToValue]to_value().()); |
| 233 | let string_vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("string-vec"); |
| 234 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 235 | string_vec, |
| 236 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["epic".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "more epic".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()] |
| 237 | ); |
| 238 | let myv = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(2.0f64.to_variantrust-analyzer cargo glib 0.22.5 variant/impl#[f64][ToVariant]to_variant().()); |
| 239 | myfoo.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("variant", &myv); |
| 240 | let var: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<glibrust-analyzer cargo glib 0.22.5 crate/::Variantrust-analyzer cargo glib 0.22.5 variant/Variant#> = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("variant"); |
| 241 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(var, myv); |
| 242 | |
| 243 | // Custom getter |
| 244 | let buzz: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("buzz"); |
| 245 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buzz, "Hello world!".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 246 | |
| 247 | // Custom setter |
| 248 | myfoo.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("fizz", "test"); |
| 249 | let fizz: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("fizz"); |
| 250 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(fizz, "custom set: test".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 251 | |
| 252 | // Multiple props on the same field |
| 253 | myfoo.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("author-name", "freddy".to_valuerust-analyzer cargo glib 0.22.5 value/impl#[str][ToValue]to_value().()); |
| 254 | let author_name: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("author-name"); |
| 255 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(author_name, "freddy".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 256 | |
| 257 | myfoo.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("author-nick", "freddy-nick".to_valuerust-analyzer cargo glib 0.22.5 value/impl#[str][ToValue]to_value().()); |
| 258 | let author_name: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("author-nick"); |
| 259 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(author_name, "freddy-nick".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 260 | |
| 261 | // read_only |
| 262 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 263 | myfoo.find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("read_only_text").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().flagsrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]flags().(), |
| 264 | ParamFlagsrust-analyzer cargo glib 0.22.5 gobject/flags/ParamFlags#::READABLErust-analyzer cargo glib 0.22.5 gobject/flags/impl#[ParamFlags]READABLE. |
| 265 | ); |
| 266 | |
| 267 | // custom flags |
| 268 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 269 | myfoo.find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("custom_flags").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().flagsrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]flags().(), |
| 270 | ParamFlagsrust-analyzer cargo glib 0.22.5 gobject/flags/ParamFlags#::EXPLICIT_NOTIFYrust-analyzer cargo glib 0.22.5 gobject/flags/impl#[ParamFlags]EXPLICIT_NOTIFY. |rust-analyzer cargo glib 0.22.5 gobject/flags/impl#[ParamFlags][`BitOr<Self>`]bitor(). ParamFlagsrust-analyzer cargo glib 0.22.5 gobject/flags/ParamFlags#::READWRITErust-analyzer cargo glib 0.22.5 gobject/flags/impl#[ParamFlags]READWRITE. |rust-analyzer cargo glib 0.22.5 gobject/flags/impl#[ParamFlags][`BitOr<Self>`]bitor(). ParamFlagsrust-analyzer cargo glib 0.22.5 gobject/flags/ParamFlags#::LAX_VALIDATIONrust-analyzer cargo glib 0.22.5 gobject/flags/impl#[ParamFlags]LAX_VALIDATION. |
| 271 | ); |
| 272 | |
| 273 | // default value |
| 274 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 275 | myfoo |
| 276 | .find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("with_default") |
| 277 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 278 | .default_valuerust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]default_value().() |
| 279 | .getrust-analyzer cargo glib 0.22.5 value/impl#[Value]get().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>() |
| 280 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 281 | "hello".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 282 | ); |
| 283 | |
| 284 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 285 | myfoo |
| 286 | .find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("fenum") |
| 287 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 288 | .default_valuerust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]default_value().() |
| 289 | .getrust-analyzer cargo glib 0.22.5 value/impl#[Value]get().::<SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#>() |
| 290 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 291 | SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#::Tworust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#Two# |
| 292 | ); |
| 293 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 294 | myfoo |
| 295 | .find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("fenum_default") |
| 296 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 297 | .default_valuerust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]default_value().() |
| 298 | .getrust-analyzer cargo glib 0.22.5 value/impl#[Value]get().::<SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#>() |
| 299 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 300 | SimpleEnumrust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#::Onerust-analyzer cargo glib-macros 0.22.6 foo/SimpleEnum#One# |
| 301 | ); |
| 302 | |
| 303 | // numeric builder |
| 304 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 305 | myfoo |
| 306 | .find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("numeric_builder") |
| 307 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 308 | .downcastrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]downcast().::<glibrust-analyzer cargo glib 0.22.5 crate/::ParamSpecUIntrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecUInt#>() |
| 309 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 310 | .maximumrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpecUInt]maximum().(), |
| 311 | 5 |
| 312 | ); |
| 313 | |
| 314 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 315 | { |
| 316 | let spec = myfoo |
| 317 | .find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("builder_fields_without_builder") |
| 318 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 319 | .downcastrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]downcast().::<glibrust-analyzer cargo glib 0.22.5 crate/::ParamSpecUIntrust-analyzer cargo glib 0.22.5 param_spec/ParamSpecUInt#>() |
| 320 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 321 | (spec.minimumrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpecUInt]minimum().(), spec.maximumrust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpecUInt]maximum().()) |
| 322 | }, |
| 323 | (0, 5) |
| 324 | ); |
| 325 | |
| 326 | // builder with required param |
| 327 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 328 | myfoo |
| 329 | .find_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]find_property().("builder_with_required_param") |
| 330 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 331 | .default_valuerust-analyzer cargo glib 0.22.5 param_spec/impl#[ParamSpec]default_value().() |
| 332 | .getrust-analyzer cargo glib 0.22.5 value/impl#[Value]get().::<char>() |
| 333 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 334 | 'c' |
| 335 | ); |
| 336 | |
| 337 | // boxed type |
| 338 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 339 | myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<foorust-analyzer cargo glib-macros 0.22.6 foo/::SimpleBoxedStringrust-analyzer cargo glib-macros 0.22.6 foo/SimpleBoxedString#>("boxed"), |
| 340 | foorust-analyzer cargo glib-macros 0.22.6 foo/::SimpleBoxedStringrust-analyzer cargo glib-macros 0.22.6 foo/SimpleBoxedString#("".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 341 | ); |
| 342 | |
| 343 | // Test `FooPropertiesExt` |
| 344 | // getters |
| 345 | { |
| 346 | // simple |
| 347 | let bar = myfoo.barrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]bar().(); |
| 348 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bar, myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("bar")); |
| 349 | |
| 350 | // custom |
| 351 | let buzz = myfoo.buzzrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]buzz().(); |
| 352 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buzz, myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("buzz")); |
| 353 | |
| 354 | // member of struct field |
| 355 | let author_nick = myfoo.author_nickrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]author_nick().(); |
| 356 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(author_nick, myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("author-nick")); |
| 357 | } |
| 358 | |
| 359 | // setters |
| 360 | { |
| 361 | // simple |
| 362 | myfoo.set_barrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_bar().("setter working"); |
| 363 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 364 | myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("bar"), |
| 365 | "setter working".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 366 | ); |
| 367 | |
| 368 | myfoo.set_doublerust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_double().(0.1); |
| 369 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<f64>("double"), 0.1); |
| 370 | |
| 371 | myfoo.set_infer_inline_typerust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_infer_inline_type().(42.0); |
| 372 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<f64>("infer-inline-type"), 42.0); |
| 373 | |
| 374 | // simple with various String types |
| 375 | myfoo.set_barrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_bar().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("setter working")); |
| 376 | myfoo.set_barrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_bar().(glibrust-analyzer cargo glib 0.22.5 crate/::GStringrust-analyzer cargo glib 0.22.5 gstring/GString#::fromrust-analyzer cargo glib 0.22.5 gstring/impl#[GString][`From<&str>`]from().("setter working")); |
| 377 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 378 | myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("bar"), |
| 379 | "setter working".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 380 | ); |
| 381 | |
| 382 | // custom |
| 383 | myfoo.set_fake_fieldrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_fake_field().("fake setter"); |
| 384 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 385 | myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("author-name"), |
| 386 | "fake setter".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 387 | ); |
| 388 | |
| 389 | // member of struct field |
| 390 | myfoo.set_author_nickrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_author_nick().("setter nick"); |
| 391 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 392 | myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("author-nick"), |
| 393 | "setter nick".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 394 | ); |
| 395 | } |
| 396 | |
| 397 | // overrides |
| 398 | { |
| 399 | let overridden: u32 = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("overridden"); |
| 400 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overridden, 43); |
| 401 | let not_overridden: u32 = myfoo.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().("not-overridden"); |
| 402 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(not_overridden, 42); |
| 403 | } |
| 404 | |
| 405 | // optional |
| 406 | myfoo.set_optionalrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_optional().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Hello world")); |
| 407 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(myfoo.optionalrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]optional().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Hello world".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())); |
| 408 | myfoo.connect_optional_notifyrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]connect_optional_notify().(|_| printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("notified")); |
| 409 | |
| 410 | // object subclass |
| 411 | let myobj = glibrust-analyzer cargo glib 0.22.5 crate/::BoxedAnyObjectrust-analyzer cargo glib 0.22.5 boxed_any_object/BoxedAnyObject#::newrust-analyzer cargo glib 0.22.5 boxed_any_object/impl#[BoxedAnyObject]new().(""); |
| 412 | myfoo.set_objectrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]set_object().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(myobj.upcast_refrust-analyzer cargo glib 0.22.5 object/Cast#upcast_ref().())); |
| 413 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(myfoo.objectrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]object().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(myobj.upcastrust-analyzer cargo glib 0.22.5 object/Cast#upcast().())); |
| 414 | |
| 415 | // construct_only |
| 416 | let myfoo: foorust-analyzer cargo glib-macros 0.22.6 foo/::Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo# = glibrust-analyzer cargo glib 0.22.5 crate/::objectrust-analyzer cargo glib 0.22.5 object/::Objectrust-analyzer cargo glib 0.22.5 object/Object#::builderrust-analyzer cargo glib 0.22.5 object/impl#[Object]builder().() |
| 417 | .propertyrust-analyzer cargo glib 0.22.5 object/impl#[`ObjectBuilder<'a, O>`]property().("construct-only-cell", 1u32) |
| 418 | .buildrust-analyzer cargo glib 0.22.5 object/impl#[`ObjectBuilder<'a, O>`]build().(); |
| 419 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(myfoo.construct_only_cellrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]construct_only_cell().(), 1u32); |
| 420 | |
| 421 | // construct_only with custom setter |
| 422 | let myfoo: foorust-analyzer cargo glib-macros 0.22.6 foo/::Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo# = glibrust-analyzer cargo glib 0.22.5 crate/::objectrust-analyzer cargo glib 0.22.5 object/::Objectrust-analyzer cargo glib 0.22.5 object/Object#::builderrust-analyzer cargo glib 0.22.5 object/impl#[Object]builder().() |
| 423 | .propertyrust-analyzer cargo glib 0.22.5 object/impl#[`ObjectBuilder<'a, O>`]property().("construct-only-custom-setter", "foo") |
| 424 | .buildrust-analyzer cargo glib 0.22.5 object/impl#[`ObjectBuilder<'a, O>`]build().(); |
| 425 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 426 | myfoo.construct_only_custom_setterrust-analyzer cargo glib-macros 0.22.6 foo/imp/impl#[`super::Foo`]construct_only_custom_setter().(), |
| 427 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("custom set: foo".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 428 | ); |
| 429 | } |
| 430 | |
| 431 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 432 | fn ext_traitrust-analyzer cargo glib-macros 0.22.6 ext_trait().() { |
| 433 | use baserust-analyzer cargo glib-macros 0.22.6 base/::imprust-analyzer cargo glib-macros 0.22.6 base/imp/::BasePropertiesExtrust-analyzer cargo glib-macros 0.22.6 base/imp/BasePropertiesExt#; |
| 434 | let base: baserust-analyzer cargo glib-macros 0.22.6 base/::Baserust-analyzer cargo glib-macros 0.22.6 base/Base# = glibrust-analyzer cargo glib 0.22.5 crate/::objectrust-analyzer cargo glib 0.22.5 object/::Objectrust-analyzer cargo glib 0.22.5 object/Object#::builderrust-analyzer cargo glib 0.22.5 object/impl#[Object]builder().().buildrust-analyzer cargo glib 0.22.5 object/impl#[`ObjectBuilder<'a, O>`]build().(); |
| 435 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(BasePropertiesExtrust-analyzer cargo glib-macros 0.22.6 base/imp/BasePropertiesExt#::overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/BasePropertiesExt#overridden().(&base), 42); |
| 436 | |
| 437 | let foo_obj: foorust-analyzer cargo glib-macros 0.22.6 foo/::Foorust-analyzer cargo glib-macros 0.22.6 foo/Foo# = glibrust-analyzer cargo glib 0.22.5 crate/::objectrust-analyzer cargo glib 0.22.5 object/::Objectrust-analyzer cargo glib 0.22.5 object/Object#::builderrust-analyzer cargo glib 0.22.5 object/impl#[Object]builder().().buildrust-analyzer cargo glib 0.22.5 object/impl#[`ObjectBuilder<'a, O>`]build().(); |
| 438 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(BasePropertiesExtrust-analyzer cargo glib-macros 0.22.6 base/imp/BasePropertiesExt#::overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/BasePropertiesExt#overridden().(&foo_obj), 43); |
| 439 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(foo_obj.overriddenrust-analyzer cargo glib-macros 0.22.6 base/imp/BasePropertiesExt#overridden().(), 43); |
| 440 | } |
| 441 | |
| 442 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 443 | fn keyword_propnamesrust-analyzer cargo glib-macros 0.22.6 keyword_propnames().() { |
| 444 | mod kw_namesrust-analyzer cargo glib-macros 0.22.6 kw_names/ { |
| 445 | mod imprust-analyzer cargo glib-macros 0.22.6 kw_names/imp/ { |
| 446 | |
| 447 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#; |
| 448 | |
| 449 | use glibrust-analyzer cargo glib 0.22.5 crate/::{preluderust-analyzer cargo glib 0.22.5 prelude/::*, subclassrust-analyzer cargo glib 0.22.5 subclass/::preluderust-analyzer cargo glib 0.22.5 subclass/prelude/::*}; |
| 450 | use glib_macrosrust-analyzer cargo glib-macros 0.22.6 crate/::Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:; |
| 451 | |
| 452 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 453 | #[properties(wrapper_type = superrust-analyzer cargo glib-macros 0.22.6 kw_names/::KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/KwNames#)] |
| 454 | pub struct KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames# { |
| 455 | // Some of the strict keywords |
| 456 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 457 | r#looprust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#loop`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 458 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 459 | r#moverust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#move`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 460 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 461 | r#typerust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#type`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 462 | |
| 463 | // Lexer 2018+ strict keywords |
| 464 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 465 | r#asyncrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#async`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 466 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 467 | r#awaitrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#await`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 468 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 469 | r#dynrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#dyn`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 470 | |
| 471 | // Some of the reserved keywords |
| 472 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 473 | r#becomerust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#become`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 474 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 475 | r#macrorust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#macro`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 476 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 477 | r#unsizedrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#unsized`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 478 | |
| 479 | // Lexer 2018+ reserved keywords |
| 480 | #[propertyrust-analyzer cargo glib-macros 0.22.6 property:(get, set)] |
| 481 | r#tryrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#`r#try`.: Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<u8>, |
| 482 | } |
| 483 | |
| 484 | #[glibrust-analyzer cargo glib 0.22.5 crate/::object_subclassrust-analyzer cargo glib-macros 0.22.2 object_subclass:] |
| 485 | impl ObjectSubclassrust-analyzer cargo glib 0.22.5 subclass/types/ObjectSubclass# for KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames# { |
| 486 | const NAMErust-analyzer cargo glib-macros 0.22.6 kw_names/imp/impl#[KwNames][ObjectSubclass]NAME.: &'static str = "MyKwNames"; |
| 487 | type Typerust-analyzer cargo glib-macros 0.22.6 kw_names/imp/impl#[KwNames][ObjectSubclass]Type# = superrust-analyzer cargo glib-macros 0.22.6 kw_names/::KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/KwNames#; |
| 488 | } |
| 489 | |
| 490 | #[glibrust-analyzer cargo glib 0.22.5 crate/::derived_propertiesrust-analyzer cargo glib-macros 0.22.2 derived_properties:] |
| 491 | impl ObjectImplrust-analyzer cargo glib 0.22.5 subclass/object/ObjectImpl# for KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames# {} |
| 492 | } |
| 493 | |
| 494 | glibrust-analyzer cargo glib 0.22.5 crate/::wrapperrust-analyzer cargo glib 0.22.5 wrapper/wrapper!! { |
| 495 | pub struct KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/KwNames#(ObjectSubclass<imprust-analyzer cargo glib-macros 0.22.6 kw_names/imp/::KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/imp/KwNames#>); |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | let mykwnames: kw_namesrust-analyzer cargo glib-macros 0.22.6 kw_names/::KwNamesrust-analyzer cargo glib-macros 0.22.6 kw_names/KwNames# = glibrust-analyzer cargo glib 0.22.5 crate/::Objectrust-analyzer cargo glib 0.22.5 object/Object#::newrust-analyzer cargo glib 0.22.5 object/impl#[Object]new().(); |
| 500 | |
| 501 | // make sure all 10 properties are registered |
| 502 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.list_propertiesrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]list_properties().().lenrust-analyzer cargo glib 0.22.5 collections/ptr_slice/impl#[`PtrSlice<T>`]len().(), 10); |
| 503 | |
| 504 | // getting property values |
| 505 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#loop(), 0); |
| 506 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#move(), 0); |
| 507 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#type(), 0); |
| 508 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#async(), 0); |
| 509 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#await(), 0); |
| 510 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#try(), 0); |
| 511 | |
| 512 | // getting property by name |
| 513 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<u8>("loop"), 0); |
| 514 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<u8>("move"), 0); |
| 515 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<u8>("type"), 0); |
| 516 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<u8>("async"), 0); |
| 517 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<u8>("await"), 0); |
| 518 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]property().::<u8>("try"), 0); |
| 519 | |
| 520 | // setting property values |
| 521 | mykwnames.set_loop(128_u8); |
| 522 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#loop(), 128_u8); |
| 523 | mykwnames.set_move(128_u8); |
| 524 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#move(), 128_u8); |
| 525 | mykwnames.set_type(128_u8); |
| 526 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#type(), 128_u8); |
| 527 | mykwnames.set_async(128_u8); |
| 528 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#async(), 128_u8); |
| 529 | mykwnames.set_await(128_u8); |
| 530 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#await(), 128_u8); |
| 531 | mykwnames.set_try(128_u8); |
| 532 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#try(), 128_u8); |
| 533 | |
| 534 | // setting property by name |
| 535 | mykwnames.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("loop", 255_u8); |
| 536 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#loop(), 255_u8); |
| 537 | mykwnames.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("move", 255_u8); |
| 538 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#loop(), 255_u8); |
| 539 | mykwnames.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("type", 255_u8); |
| 540 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#loop(), 255_u8); |
| 541 | mykwnames.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("async", 255_u8); |
| 542 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#async(), 255_u8); |
| 543 | mykwnames.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("await", 255_u8); |
| 544 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#await(), 255_u8); |
| 545 | mykwnames.set_propertyrust-analyzer cargo glib 0.22.5 object/impl#[T][ObjectExt]set_property().("try", 255_u8); |
| 546 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mykwnames.r#try(), 255_u8); |
| 547 | } |
| 548 | |
| 549 | /// This struct is intentionally left empty. |
| 550 | /// |
| 551 | /// Ensure the code compiles even when no properties are specified at all. |
| 552 | /// This is useful for refactoring. |
| 553 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 554 | #[allow(unreachable_code)] |
| 555 | fn empty_structrust-analyzer cargo glib-macros 0.22.6 empty_struct().() { |
| 556 | mod emptyrust-analyzer cargo glib-macros 0.22.6 empty/ { |
| 557 | mod imprust-analyzer cargo glib-macros 0.22.6 empty/imp/ { |
| 558 | use glibrust-analyzer cargo glib 0.22.5 crate/::subclassrust-analyzer cargo glib 0.22.5 subclass/::preluderust-analyzer cargo glib 0.22.5 subclass/prelude/::*; |
| 559 | use glib_macrosrust-analyzer cargo glib-macros 0.22.6 crate/::Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:; |
| 560 | |
| 561 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Propertiesrust-analyzer cargo glib-macros 0.22.6 Properties:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 562 | #[properties(wrapper_type = superrust-analyzer cargo glib-macros 0.22.6 empty/::Emptyrust-analyzer cargo glib-macros 0.22.6 empty/Empty#)] |
| 563 | pub struct Emptyrust-analyzer cargo glib-macros 0.22.6 empty/imp/Empty# {} |
| 564 | |
| 565 | #[glibrust-analyzer cargo glib 0.22.5 crate/::object_subclassrust-analyzer cargo glib-macros 0.22.2 object_subclass:] |
| 566 | impl ObjectSubclassrust-analyzer cargo glib 0.22.5 subclass/types/ObjectSubclass# for Emptyrust-analyzer cargo glib-macros 0.22.6 empty/imp/Empty# { |
| 567 | const NAMErust-analyzer cargo glib-macros 0.22.6 empty/imp/impl#[Empty][ObjectSubclass]NAME.: &'static str = "Empty"; |
| 568 | type Typerust-analyzer cargo glib-macros 0.22.6 empty/imp/impl#[Empty][ObjectSubclass]Type# = superrust-analyzer cargo glib-macros 0.22.6 empty/::Emptyrust-analyzer cargo glib-macros 0.22.6 empty/Empty#; |
| 569 | } |
| 570 | |
| 571 | #[glibrust-analyzer cargo glib 0.22.5 crate/::derived_propertiesrust-analyzer cargo glib-macros 0.22.2 derived_properties:] |
| 572 | impl ObjectImplrust-analyzer cargo glib 0.22.5 subclass/object/ObjectImpl# for Emptyrust-analyzer cargo glib-macros 0.22.6 empty/imp/Empty# {} |
| 573 | } |
| 574 | |
| 575 | glibrust-analyzer cargo glib 0.22.5 crate/::wrapperrust-analyzer cargo glib 0.22.5 wrapper/wrapper!! { |
| 576 | pub struct Emptyrust-analyzer cargo glib-macros 0.22.6 empty/Empty#(ObjectSubclass<imprust-analyzer cargo glib-macros 0.22.6 empty/imp/::Emptyrust-analyzer cargo glib-macros 0.22.6 empty/imp/Empty#>); |
| 577 | } |
| 578 | } |
| 579 | } |