Skip to content

Commit

Permalink
feat(macros): 🎸 derive Declare will generate FatObj
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Adoo committed Mar 1, 2024
1 parent b0b8b7c commit c455cf1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/src/builtin_widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ pub use key::{Key, KeyWidget};
pub mod image_widget;
pub use image_widget::*;
pub mod delay_drop;
pub use delay_drop::DelayDrop;
pub use delay_drop::*;
mod theme;
use ribir_algo::Sc;
pub use theme::*;
mod cursor;
pub use cursor::Cursor;
pub use cursor::*;
pub use winit::window::CursorIcon;
mod margin;
pub use margin::*;
Expand Down
8 changes: 4 additions & 4 deletions core/src/builtin_widgets/mix_builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ impl MixBuiltin {
}

impl MixBuiltinDeclarer {
pub fn tab_index<_M, _V>(self, v: _V) -> Self
pub fn tab_index<M, V>(self, v: V) -> Self
where
DeclareInit<i16>: DeclareFrom<_V, _M>,
DeclareInit<i16>: DeclareFrom<V, M>,
{
let inner = self.0.read();
self.0.read().flag_mark(BuiltinFlags::Focus);
Expand All @@ -370,9 +370,9 @@ impl MixBuiltinDeclarer {
self
}

pub fn auto_focus<_M, _V>(self, v: _V) -> Self
pub fn auto_focus<M, V>(self, v: V) -> Self
where
DeclareInit<bool>: DeclareFrom<_V, _M>,
DeclareInit<bool>: DeclareFrom<V, M>,
{
let inner = self.0.read();
inner.flag_mark(BuiltinFlags::Focus);
Expand Down
3 changes: 2 additions & 1 deletion core/src/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ impl<V, U: From<V>> DeclareFrom<V, ()> for DeclareInit<U> {
fn declare_from(value: V) -> Self { Self::Value(value.into()) }
}

impl<P: Pipe + 'static, V> DeclareFrom<P, &dyn Pipe<Value = ()>> for DeclareInit<V>
impl<P, V> DeclareFrom<P, &dyn Pipe<Value = ()>> for DeclareInit<V>
where
P: Pipe + 'static,
V: From<P::Value> + 'static,
{
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion macros/src/simple_declarer_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl<'a> DeclareField<'a> {
.map_or(true, |attr| attr.custom.is_none() && attr.skip.is_none())
}

pub fn check_reserve(&mut self) {
pub fn check_reserve(&self) {
// reverse name check.
let reserve_ident = &crate::variable_names::RESERVE_IDENT;

Expand Down

0 comments on commit c455cf1

Please sign in to comment.