libobs_sources/
macro_helper.rs

1
2macro_rules! define_object_manager {
3    ($(#[$parent_meta:meta])* struct $struct_name:ident($obs_id:literal) for $updatable_name:ident {
4        $(
5            $(#[$meta:meta])*
6            $field:ident: $ty:ty,
7        )*
8    }) => {
9        paste::paste! {
10            #[libobs_source_macro::obs_object_builder($obs_id)]
11            $(#[$parent_meta])*
12            pub struct [<$struct_name Builder>] {
13                $(
14                    $(#[$meta])*
15                    $field: $ty,
16                )*
17            }
18
19            #[libobs_source_macro::obs_object_updater($obs_id, $updatable_name)]
20            /// Used to update the source this updater was created from. For more details look
21            /// at docs for the corresponding builder.
22            pub struct [<$struct_name Updater>] {
23                $(
24                    $(#[$meta])*
25                    $field: $ty,
26                )*
27            }
28        }
29    };
30}
31
32pub(crate) use define_object_manager;