Skip to content

Commit cb71ea9

Browse files
committed
Remove the fully qualified path to the ref_signal! macro, and allow users to import it themselves based on the error message.
1 parent 974818a commit cb71ea9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cache/src/effect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ where
9797
/// ```
9898
/// use std::{cell::Cell, rc::Rc};
9999
/// use reactive_cache::Effect;
100-
/// use reactive_macros::signal;
100+
/// use reactive_macros::{ref_signal, signal};
101101
///
102102
/// signal!(static mut FLAG: bool = true;);
103103
/// signal!(static mut COUNTER: i32 = 10;);
@@ -123,7 +123,7 @@ where
123123
/// );
124124
///
125125
/// assert_eq!(result.get(), 0); // runs with FLAG = true
126-
///
126+
///
127127
/// // Changing `FLAG` to false will trigger the effect
128128
/// FLAG_set(false);
129129
/// assert_eq!(result.get(), 10);

cache/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/// ```rust
2424
/// use std::{cell::Cell, rc::Rc};
2525
/// use reactive_cache::effect;
26-
/// use reactive_macros::signal;
26+
/// use reactive_macros::{ref_signal, signal};
2727
///
2828
/// signal!(static mut A: i32 = 1;);
2929
///

macros/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syn::{Ident, ItemFn, ItemStatic, ReturnType, parse_macro_input};
1010
/// 1. A `_get()` function that returns a reference to the value, allowing read access.
1111
/// - This reference behaves like a normal immutable reference for most purposes.
1212
/// 2. A `_set(value)` function to write the value (returns `true` if changed).
13-
///
13+
///
1414
/// Unlike `signal!`, `ref_signal!` does **not** generate a same-named function that directly returns the value.
1515
///
1616
/// # Requirements
@@ -119,7 +119,7 @@ pub fn ref_signal(input: TokenStream) -> TokenStream {
119119
/// # Examples
120120
///
121121
/// ```rust
122-
/// use reactive_macros::signal;
122+
/// use reactive_macros::{ref_signal, signal};
123123
///
124124
/// signal!(static mut A: i32 = 10;);
125125
///
@@ -161,7 +161,7 @@ pub fn signal(input: TokenStream) -> TokenStream {
161161
let ident_fn = format_ident!("{}", ident);
162162

163163
let expanded = quote! {
164-
reactive_macros::ref_signal!(#input_clone);
164+
ref_signal!(#input_clone);
165165

166166
#[allow(non_snake_case)]
167167
pub fn #ident_fn() -> #ty {

0 commit comments

Comments
 (0)