Crate perseus_macro[][src]

Expand description

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability. It wraps the lower-level capabilities of Sycamore and provides a NextJS-like API!

  • ✨ Supports static generation (serving only static resources)
  • ✨ Supports server-side rendering (serving dynamic resources)
  • ✨ Supports revalidation after time and/or with custom logic (updating rendered pages)
  • ✨ Supports incremental regeneration (build on demand)
  • ✨ Open build matrix (use any rendering strategy with anything else, mostly)
  • ✨ CLI harness that lets you build apps with ease and confidence

This is the documentation for the Perseus macros, but there’s also a CLI, the core package, and other integrations to make serving apps on other platforms easier!

Resources

These docs will help you as a reference, but the book should be your first port of call for learning about how to use Perseus and how it works.

Attribute Macros

Automatically serializes/deserializes properties for a template. Perseus handles your templates’ properties as Strings under the hood for both simplicity and to avoid bundle size increases from excessive monomorphization. This macro aims to prevent the need for manually serializing and deserializing everything! This takes the type of function that it’s working on, which must be one of the following:

Labels a function as a Perseus head function, which is very similar to a template, but for the HTML metadata in the document <head>.

Labels a Sycamore component as a Perseus template, turning it into something that can be easily inserted into the .template() function, avoiding the need for you to manually serialize/deserialize things. This should be provided the name of the Sycamore component (same as given to Sycamore’s #[component()], but without the <G>).

Marks the given function as a Perseus test. Functions marked with this attribute must have the following signature: async fn foo(client: &mut fantoccini::Client) -> Result<>.