11//! See [`style!`](crate::style!).
22
3- pub use frender_const_expr:: { array_len, const_marker} ;
4-
53/// Styles separated by comma.
64///
75/// The macro input will be parsed as [style syntaxes](one) separated by comma.
@@ -23,57 +21,12 @@ pub use style as comma_separated;
2321#[ doc( hidden) ]
2422#[ macro_export]
2523macro_rules! style_const {
26- ( const $( $rest: tt) * ) => { {
27- enum HasConstDeclarationList { }
28- $crate:: style:: r#const! {
29- #[ const_marker( HasConstDeclarationList ) ]
30- const $( $rest) *
31- }
32- } } ;
33- (
34- #[ $const_marker: ident $const_marker_body: tt]
35- const $s: tt
36- ) => {
37- $crate:: style:: r#const! {
38- #[ $const_marker $const_marker_body]
39- const $s as _
24+ ( $( $t: tt) * ) => {
25+ $crate:: style:: __private:: r#const! {
26+ #[ const_impl_mod( $crate:: style:: __private:: const_impl) ]
27+ $( $t) *
4028 }
4129 } ;
42- (
43- #[ $const_marker: ident $const_marker_body: tt]
44- const $s: tt as $( $const_ty: tt) *
45- ) => { {
46- const CONST_EXPR : $crate:: styles:: constness:: ConstDeclarationList :: <
47- $crate:: style:: const_marker:: $const_marker!$const_marker_body
48- > = {
49- $crate:: impl_has_const_declaration_list_for! {
50- impl $crate:: style:: const_marker:: $const_marker!$const_marker_body {
51- const _: $crate:: __style_infer_const_type![ $s $( $const_ty) * ] = $s;
52- }
53- }
54-
55- $crate:: styles:: constness:: ConstDeclarationList ( )
56- } ;
57-
58- CONST_EXPR
59- } } ;
60- }
61-
62- #[ doc( hidden) ]
63- #[ macro_export]
64- macro_rules! __style_infer_const_type {
65- ( { [ $( $array: tt) * ] } _) => {
66- [ $crate:: styles:: constness:: StaticStr ; $crate:: style:: array_len!( [ $( $array) * ] ) ]
67- } ;
68- ( { [ $( $array: tt) * ] } [ $item_ty: ty; _] ) => {
69- [ $item_ty; $crate:: __dom_tokens_array_len!( [ $( $array) * ] ) ]
70- } ;
71- ( $block: tt _) => {
72- $crate:: styles:: constness:: StaticStr
73- } ;
74- ( $block: tt $ty: ty) => {
75- $ty
76- } ;
7730}
7831
7932/// ### Supported style syntaxes
@@ -150,6 +103,23 @@ pub mod syntax {
150103 }
151104}
152105
106+ #[ doc( hidden) ]
107+ pub mod __private {
108+ #[ doc( hidden) ]
109+ pub use frender_const_expr:: { const_marker, r#const} ;
110+
111+ #[ doc( hidden) ]
112+ pub mod const_impl {
113+ #[ doc( hidden) ]
114+ pub use crate :: {
115+ impl_has_const_declaration_list_for as impl_marker_for,
116+ styles:: constness:: {
117+ ConstDeclarationList as ConstValue , HasConstDeclarationList as HasConstValue ,
118+ } ,
119+ } ;
120+ }
121+ }
122+
153123#[ cfg( test) ]
154124mod tests {
155125 use crate :: {
0 commit comments