Skip to content

Commit

Permalink
feat(macros): 🎸 add simple_declarer that not support use pipe to in…
Browse files Browse the repository at this point in the history
…it value
  • Loading branch information
M-Adoo committed Feb 28, 2024
1 parent 72fce42 commit 47a1616
Show file tree
Hide file tree
Showing 6 changed files with 418 additions and 295 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ Please only add new entries below the [Unreleased](#unreleased---releasedate) he

## [@Unreleased] - @ReleaseDate

## [0.2.0-alpha.4] - 2024-02-27
## Features

- **macros**: Introduced `simple_declarer` macro for types that don't use `Pipe` for initialization. (#535 @M-Adoo)

### Fixed

- Optimization, StateReader auto unsubscribe if not writer(#532 @wjian23)
## [0.2.0-alpha.4] - 2024-02-27

### Changed

- **core**: StateReader now automatically unsubscribes when no writer is present (#532 @wjian23)
- **core**: Consolidated all listener and `FocusNode` into a `MixBuiltin` widget (#534 @M-Adoo)
- The `MixBuiltin` widget reduces memory usage and allows users to utilize all `on_xxx` event handlers, not only during the build declaration but also after the widget has been built.

Expand Down
10 changes: 0 additions & 10 deletions core/src/builtin_widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ macro_rules! impl_builtin_obj {
&& $(self.[< $builtin_ty: snake:lower >].is_none())&& *
}

$(
pub fn [< $builtin_ty: snake:lower >](&mut self, ctx: &BuildCtx)
-> &mut State<$builtin_ty>
{
self
.[< $builtin_ty: snake:lower >]
.get_or_insert_with(|| $builtin_ty::declare_builder().build_declare(ctx))
}
)*

$(
pub fn [< set_builtin_ $builtin_ty: snake:lower >](
mut self, builtin: State<$builtin_ty>
Expand Down
4 changes: 2 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ pub mod prelude {
pub use ribir_geom::*;
#[doc(no_inline)]
pub use ribir_macros::{
ctx, fn_widget, include_svg, map_writer, pipe, rdl, ribir_expanded_ಠ_ಠ, split_writer, watch,
Declare, Lerp, MultiChild, PairChild, Query, SingleChild, Template,
ctx, fn_widget, include_svg, map_writer, pipe, rdl, ribir_expanded_ಠ_ಠ, simple_declarer,
split_writer, watch, Declare, Lerp, MultiChild, PairChild, Query, SingleChild, Template,
};
#[doc(no_inline)]
pub use ribir_painter::*;
Expand Down
Loading

0 comments on commit 47a1616

Please sign in to comment.