rstml-component
is a Rust library that empowers developers to create dynamic HTML components efficiently. With this library, you can define HTML components using Rust structs and easily generate HTML on-the-fly, making it especially useful for server-side applications that need to produce HTML content.
Declarative Component Definition: Define HTML components using Rust structs, making your code more organized and maintainable.
Effortless HTML Generation: Generate HTML content dynamically by leveraging the power of Rust's expressive syntax.
Designed for Server-Side Applications: Perfectly suited for server applications that need to generate HTML content on-the-fly.
Template Reusability: Create reusable templates by structuring components, enhancing code reusability across your project.
To use rstml-component
in your Rust project, simply add it as a dependency in your Cargo.toml
:
toml
[dependencies]
rstml-component = "0.2.0"
Here's a quick example to demonstrate how easy it is to define and use HTML components using rstml-component
:
```rust use rstml_component::{HtmlComponent, HtmlContent, HtmlFormatter};
struct Page
impl "This is a test"{self.heading}
// Example Axum handler - requires rstml-component-axum async fn index() -> impl IntoResponse { Page { title: "My Title", heading: "Page Heading", } .into_html() } ```
For more detailed information and examples, please refer to our Documentation.
This project is licensed under the MIT License.