Skip to content

Commit ffd4ca3

Browse files
Change to any node ref
1 parent 859773c commit ffd4ca3

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

packages/leptos-node-ref/src/generic_node_ref.rs renamed to packages/leptos-node-ref/src/any_node_ref.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ use send_wrapper::SendWrapper;
99

1010
/// A reactive reference to a DOM node that can be used with the `node_ref` attribute.
1111
#[derive(Debug)]
12-
pub struct GenericNodeRef(RwSignal<Option<SendWrapper<Element>>>);
12+
pub struct AnyNodeRef(RwSignal<Option<SendWrapper<Element>>>);
1313

14-
impl GenericNodeRef {
14+
impl AnyNodeRef {
1515
/// Creates a new node reference.
1616
#[track_caller]
1717
pub fn new() -> Self {
1818
Self(RwSignal::new(None))
1919
}
2020
}
2121

22-
impl Default for GenericNodeRef {
22+
impl Default for AnyNodeRef {
2323
fn default() -> Self {
2424
Self::new()
2525
}
2626
}
2727

28-
impl Clone for GenericNodeRef {
28+
impl Clone for AnyNodeRef {
2929
fn clone(&self) -> Self {
3030
*self
3131
}
3232
}
3333

34-
impl Copy for GenericNodeRef {}
34+
impl Copy for AnyNodeRef {}
3535

36-
impl DefinedAt for GenericNodeRef {
36+
impl DefinedAt for AnyNodeRef {
3737
fn defined_at(&self) -> Option<&'static std::panic::Location<'static>> {
3838
self.0.defined_at()
3939
}
4040
}
4141

42-
impl ReadUntracked for GenericNodeRef {
42+
impl ReadUntracked for AnyNodeRef {
4343
type Value = ReadGuard<Option<Element>, Derefable<Option<Element>>>;
4444

4545
fn try_read_untracked(&self) -> Option<Self::Value> {
@@ -49,15 +49,15 @@ impl ReadUntracked for GenericNodeRef {
4949
}
5050
}
5151

52-
impl Track for GenericNodeRef {
52+
impl Track for AnyNodeRef {
5353
fn track(&self) {
5454
self.0.track();
5555
}
5656
}
5757

58-
macro_rules! impl_generic_node_ref {
58+
macro_rules! impl_any_node_ref {
5959
($($element:ident),*,) => {
60-
$(impl NodeRefContainer<leptos::html::$element> for GenericNodeRef {
60+
$(impl NodeRefContainer<leptos::html::$element> for AnyNodeRef {
6161
fn load(self, el: &Element) {
6262
// safe to construct SendWrapper here, because it will only run in the browser
6363
// so it will always be accessed or dropped from the main thread
@@ -67,7 +67,7 @@ macro_rules! impl_generic_node_ref {
6767
};
6868
}
6969

70-
impl_generic_node_ref!(
70+
impl_any_node_ref!(
7171
A, Abbr, Address, Area, Article, Aside, Audio, B, Base, Bdi, Bdo, Blockquote, Body, Br, Button,
7272
Canvas, Caption, Cite, Code, Col, Colgroup, Data, Datalist, Dd, Del, Details, Dfn, Dialog, Div,
7373
Dl, Dt, Em, Embed, Fieldset, Figcaption, Figure, Footer, Form, H1, H2, H3, H4, H5, H6, Head,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Node reference extras for [Leptos](https://leptos.dev/).
22
//!
3-
mod generic_node_ref;
3+
mod any_node_ref;
44

5-
pub use generic_node_ref::*;
5+
pub use any_node_ref::*;

0 commit comments

Comments
 (0)