Skip to content

Commit

Permalink
feat: trait Element
Browse files Browse the repository at this point in the history
  • Loading branch information
EqualMa committed Jun 8, 2023
1 parent c90098c commit e24414b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions frender/src/element.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use frender_csr::CsrElement;
use frender_ssr::SsrElement;

/// A trait alias for <code>[CsrElement] + [SsrElement]</code>
pub trait Element: CsrElement + SsrElement {}

impl<E: CsrElement + SsrElement> Element for E {}
5 changes: 4 additions & 1 deletion frender/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
mod debug;
pub use debug::*;

mod element;
pub use element::*;

#[cfg(feature = "hooks")]
pub mod hooks_ext;

Expand Down Expand Up @@ -45,7 +48,7 @@ pub mod prelude {
#[cfg(feature = "bg")]
pub use bg::{Maybe as _, MaybeBorrow as _};

pub use crate::{rsx, StaticText};
pub use crate::{rsx, Element, StaticText};

pub use frender_hook_element::{component_fn, RenderWith};

Expand Down

0 comments on commit e24414b

Please sign in to comment.