Skip to content

Commit 93ad70b

Browse files
committed
feat: impl Style for frender_common::Empty
1 parent ef13ae1 commit 93ad70b

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

packages/frender-style/src/ssr.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ pub mod assert {
1919
{
2020
}
2121

22+
impl sealed::DeclarationList for async_str_iter::empty::Empty {}
23+
impl DeclarationList for async_str_iter::empty::Empty {}
24+
25+
impl sealed::DeclarationListPrefixSemicolon for async_str_iter::empty::Empty {}
26+
impl DeclarationListPrefixSemicolon for async_str_iter::empty::Empty {}
27+
2228
impl sealed::DeclarationList for async_str_iter::never::Never {}
2329
impl DeclarationList for async_str_iter::never::Never {}
2430

@@ -161,6 +167,22 @@ mod imp {
161167

162168
use super::{sealed, SsrDeclarationList};
163169

170+
impl sealed::SsrDeclarationList for frender_common::Empty {}
171+
impl SsrDeclarationList for frender_common::Empty {
172+
type IntoDeclarationList = async_str_iter::empty::Empty;
173+
type IntoDeclarationListPrefixSemicolon = async_str_iter::empty::Empty;
174+
175+
fn into_declaration_list(Self: Self) -> Self::IntoDeclarationList {
176+
async_str_iter::empty::Empty
177+
}
178+
179+
fn into_declaration_list_prefix_semicolon(
180+
Self: Self,
181+
) -> Self::IntoDeclarationListPrefixSemicolon {
182+
async_str_iter::empty::Empty
183+
}
184+
}
185+
164186
impl<T: SsrDeclarationList> sealed::SsrDeclarationList for Option<T> {}
165187

166188
impl<T: SsrDeclarationList> SsrDeclarationList for Option<T> {

packages/frender-style/src/styles.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pub use frender_common::Empty;
22

3+
mod empty;
4+
35
mod chain;
46
pub use chain::Chain;
57

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
mod csr {
2+
use frender_common::Empty;
3+
4+
use crate::csr::CsrStyle;
5+
6+
impl CsrStyle for Empty {
7+
type State = ();
8+
9+
fn csr_style_render_init(
10+
Self: Self,
11+
_: &mut impl crate::csr::CssStyleDeclaration,
12+
) -> Self::State {
13+
}
14+
15+
fn csr_style_render_update(
16+
Self: Self,
17+
_: &mut impl crate::csr::CssStyleDeclaration,
18+
(): &mut Self::State,
19+
) {
20+
}
21+
}
22+
}
23+
24+
mod ssr {
25+
use frender_common::Empty;
26+
27+
use crate::ssr::SsrStyle;
28+
29+
impl SsrStyle for Empty {
30+
type IntoSsrDeclarationList = Self;
31+
32+
fn into_ssr_declaration_list(this: Self) -> Self::IntoSsrDeclarationList {
33+
this
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)