diff --git a/examples/rsx_usage.rs b/examples/rsx_usage.rs index 25466943f..78ec424f9 100644 --- a/examples/rsx_usage.rs +++ b/examples/rsx_usage.rs @@ -183,7 +183,7 @@ fn app() -> Element { // Can take children too! Taller { a: "asd", div {"hello world!"} } - // This component's props are defined *inline* with the `inline_props` macro + // This component's props are defined *inline* with the `component` macro WithInline { text: "using functionc all syntax" } // Components can be generic too @@ -193,7 +193,7 @@ fn app() -> Element { // Type inference can be used too TypedInput { initial: 10.0 } - // generic with the `inline_props` macro + // generic with the `component` macro Label { text: "hello generic world!" } Label { text: 99.9 } diff --git a/packages/core-macro/src/lib.rs b/packages/core-macro/src/lib.rs index 9046036ba..3ff19d9be 100644 --- a/packages/core-macro/src/lib.rs +++ b/packages/core-macro/src/lib.rs @@ -13,24 +13,9 @@ mod utils; use dioxus_rsx as rsx; -/// Format a string with inline rust expressions. [`format_args_f!`] is very similar to [`format_args`], but it allows you to use arbitrary rust expressions inside braces instead of just variables: -/// -/// ```rust,no_run -/// # use dioxus::prelude::*; -/// let formatted_with_variables = format_args!("{} + {} = {}", 1, 2, 1 + 2); -/// let formatted_with_inline_expressions = format_args_f!("{1} + {2} = {1 + 2}"); -/// ``` -#[proc_macro] -pub fn format_args_f(input: TokenStream) -> TokenStream { - use rsx::*; - format_args_f_impl(parse_macro_input!(input as IfmtInput)) - .unwrap_or_else(|err| err.to_compile_error()) - .into() -} - #[doc = include_str!("../docs/props.md")] #[proc_macro_derive(Props, attributes(props))] -pub fn derive_typed_builder(input: TokenStream) -> TokenStream { +pub fn derive_props(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as syn::DeriveInput); match props::impl_my_derive(&input) { Ok(output) => output.into(), @@ -47,13 +32,6 @@ pub fn rsx(tokens: TokenStream) -> TokenStream { } } -/// The rsx! macro makes it easy for developers to write jsx-style markup in their components. -#[deprecated(note = "Use `rsx!` instead.")] -#[proc_macro] -pub fn render(tokens: TokenStream) -> TokenStream { - rsx(tokens) -} - #[doc = include_str!("../docs/component.md")] #[proc_macro_attribute] pub fn component(_args: TokenStream, input: TokenStream) -> TokenStream { @@ -61,39 +39,3 @@ pub fn component(_args: TokenStream, input: TokenStream) -> TokenStream { .into_token_stream() .into() } - -/// Derive props for a component within the component definition. -/// -/// This macro provides a simple transformation from `Scope<{}>` to `Scope

`, -/// removing some boilerplate when defining props. -/// -/// You don't *need* to use this macro at all, but it can be helpful in cases where -/// you would be repeating a lot of the usual Rust boilerplate. -/// -/// # Example -/// ```rust,no_run -/// # use dioxus::prelude::*; -/// #[inline_props] -/// fn GreetBob(bob: String) -> Element { -/// rsx! { "hello, {bob}" } -/// } -/// ``` -/// -/// is equivalent to -/// -/// ```rust,no_run -/// # use dioxus::prelude::*; -/// #[derive(PartialEq, Props, Clone)] -/// struct AppProps { -/// bob: String, -/// } -/// -/// fn GreetBob(props: AppProps) -> Element { -/// rsx! { "hello, {props.bob}" } -/// } -/// ``` -#[proc_macro_attribute] -#[deprecated(note = "Use `#[component]` instead.")] -pub fn inline_props(args: TokenStream, input: TokenStream) -> TokenStream { - component(args, input) -} diff --git a/packages/core-macro/tests/ifmt.rs b/packages/core-macro/tests/ifmt.rs deleted file mode 100644 index 2883b8fd6..000000000 --- a/packages/core-macro/tests/ifmt.rs +++ /dev/null @@ -1,34 +0,0 @@ -use dioxus_core_macro::*; - -#[test] -fn formatting_compiles() { - let x = (0, 1); - // escape sequences work - assert_eq!( - format_args_f!("{x:?} {{}}}}").to_string(), - format!("{x:?} {{}}}}") - ); - assert_eq!( - format_args_f!("{{{{}} {x:?}").to_string(), - format!("{{{{}} {x:?}") - ); - - // paths in formating works - assert_eq!(format_args_f!("{x.0}").to_string(), format!("{}", x.0)); - - // function calls in formatings work - assert_eq!( - format_args_f!("{blah(&x):?}").to_string(), - format!("{:?}", blah(&x)) - ); - - // allows duplicate format args - assert_eq!( - format_args_f!("{x:?} {x:?}").to_string(), - format!("{x:?} {x:?}") - ); -} - -fn blah(hi: &(i32, i32)) -> String { - format_args_f!("{hi.0} {hi.1}").to_string() -} diff --git a/packages/dioxus-lib/src/lib.rs b/packages/dioxus-lib/src/lib.rs index e04423de7..abf5140d6 100644 --- a/packages/dioxus-lib/src/lib.rs +++ b/packages/dioxus-lib/src/lib.rs @@ -33,7 +33,7 @@ pub mod prelude { #[cfg(feature = "macro")] #[allow(deprecated)] - pub use dioxus_core_macro::{component, format_args_f, inline_props, render, rsx, Props}; + pub use dioxus_core_macro::{component, rsx, Props}; #[cfg(feature = "macro")] pub use dioxus_config_macro::*; diff --git a/packages/dioxus/src/lib.rs b/packages/dioxus/src/lib.rs index 5e7c99447..f9dd85c46 100644 --- a/packages/dioxus/src/lib.rs +++ b/packages/dioxus/src/lib.rs @@ -77,7 +77,7 @@ pub mod prelude { #[cfg(feature = "macro")] #[cfg_attr(docsrs, doc(cfg(feature = "macro")))] #[allow(deprecated)] - pub use dioxus_core_macro::{component, format_args_f, inline_props, render, rsx, Props}; + pub use dioxus_core_macro::{component, rsx, Props}; #[cfg(feature = "launch")] #[cfg_attr(docsrs, doc(cfg(feature = "launch")))]