viewy-codegen

Crates.ioviewy-codegen
lib.rsviewy-codegen
version1.13.1
sourcesrc
created_at2023-08-11 08:39:06.27
updated_at2024-10-29 12:27:29.404154
descriptionProcedural macros for Viewy web ui library.
homepage
repositoryhttps://github.com/strowbeary/viewy-rs
max_upload_size
id941683
size2,389
Rémi Caillot (strowbeary)

documentation

https://docs.rs/viewy

README

Viewy

A UI toolkit that combine the advantages of a design system and an ui library.

  • Customizable theme via config file
  • For small and more complex projects

"Hello, World!" example program (rocket.rs)

use viewy::*;
use viewy::components::*;
#[macro_use] extern crate rocket;

pub fn default_layout() -> Box<dyn Fn(Box<dyn Renderable>) -> Box<dyn Renderable>> {
    Box::new(move |content| Box::new({
        content
    }))
}

#[get("/")]
fn index() -> RawHtml<String> {
   RawHtml({
       Page::new(
           &format!("{} – Viewy", "Hello World"),
           &default_layout(),
           {
               Text::new("Hello world", TextStyle::LargeTitle)
           }
       )
           .compile(RenderMode::Complete)
   })
}

#[launch]
fn rocket() -> _ {
    rocket::build().mount("/", routes![index])
}

Commit count: 617

cargo fmt