Skip to content

Commit

Permalink
feat: change the macro name
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Dec 5, 2024
1 parent 19d93a5 commit bf636dc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions iced_examples/counter_mulit_pattern/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use iced_runtime::{task, Action};
use iced_layershell::build_pattern::{daemon, MainSettings};
use iced_layershell::reexport::{Anchor, KeyboardInteractivity, Layer, NewLayerShellSettings};
use iced_layershell::settings::{LayerShellSettings, StartMode};
use iced_layershell::{to_layer_message, LayerSingleton};
use iced_layershell::{to_layer_message, WindowInfoMarker};

pub fn main() -> Result<(), iced_layershell::Error> {
tracing_subscriber::fmt().init();
Expand Down Expand Up @@ -43,7 +43,7 @@ struct Counter {
ids: HashMap<iced::window::Id, WindowInfo>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, LayerSingleton)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, WindowInfoMarker)]
enum WindowInfo {
#[singleton]
Left,
Expand Down
4 changes: 2 additions & 2 deletions iced_examples/counter_muti/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use iced_runtime::{task, Action};
use iced_layershell::reexport::{Anchor, KeyboardInteractivity, Layer, NewLayerShellSettings};
use iced_layershell::settings::{LayerShellSettings, Settings, StartMode};
use iced_layershell::MultiApplication;
use iced_layershell::{to_layer_message, LayerSingleton};
use iced_layershell::{to_layer_message, WindowInfoMarker};

pub fn main() -> Result<(), iced_layershell::Error> {
tracing_subscriber::fmt().init();
Expand All @@ -32,7 +32,7 @@ struct Counter {
ids: HashMap<iced::window::Id, WindowInfo>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, LayerSingleton)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, WindowInfoMarker)]
enum WindowInfo {
#[singleton]
Left,
Expand Down
5 changes: 1 addition & 4 deletions iced_layershell/src/build_pattern/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ pub trait Program: Sized {
type State;
type Renderer: Renderer;

type WindowInfo: Clone
+ PartialEq
+ IsSingleton
+ TryFrom<MainWindowInfo, Error = ()>;
type WindowInfo: Clone + PartialEq + IsSingleton + TryFrom<MainWindowInfo, Error = ()>;
/// The type of __messages__ your [`Application`] will produce.
type Message: std::fmt::Debug
+ Send
Expand Down
2 changes: 1 addition & 1 deletion iced_layershell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use settings::Settings;
use iced_runtime::Task;

pub use iced_layershell_macros::to_layer_message;
pub use iced_layershell_macros::LayerSingleton;
pub use iced_layershell_macros::WindowInfoMarker;

pub use error::Error;

Expand Down
4 changes: 2 additions & 2 deletions iced_layershell/tests/test_macro.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use iced_layershell::actions::IsSingleton;
use iced_layershell::{to_layer_message, LayerSingleton};
use iced_layershell::{to_layer_message, windowinfo_marker};

#[test]
fn test_layer_message_macro() {
Expand All @@ -15,7 +15,7 @@ fn test_layer_message_macro() {
#[test]
fn test_layersingleton_derive() {
#[allow(unused)]
#[derive(LayerSingleton)]
#[derive(windowinfo_marker)]
enum SingleToneTest {
#[singleton]
SingleTon,
Expand Down
4 changes: 2 additions & 2 deletions iced_layershell_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fn is_mainwindow_attr(attr: &Attribute) -> bool {
attr.path().is_ident("main")
}

#[proc_macro_derive(LayerSingleton, attributes(singleton, main))]
pub fn layer_singleton(input: TokenStream) -> TokenStream {
#[proc_macro_derive(WindowInfoMarker, attributes(singleton, main))]
pub fn window_info_marker(input: TokenStream) -> TokenStream {
// Parse the input as a DeriveInput
let input = parse_macro_input!(input as DeriveInput);

Expand Down

0 comments on commit bf636dc

Please sign in to comment.