Skip to main content

Crate rustango_macros

Crate rustango_macros 

Source
Expand description

Proc-macros for rustango.

v0.1 ships #[derive(Model)], which emits:

  • a Model impl carrying a static ModelSchema,
  • an inventory::submit! so the model is discoverable from the registry,
  • an inherent objects() returning a QuerySet<Self>,
  • a sqlx::FromRow impl so query results decode into the struct.

Macros§

embed_migrations
Bake every *.json migration file in a directory into the binary at compile time. Returns a &'static [(&'static str, &'static str)] of (name, json_content) pairs, lex-sorted by file stem.

Attribute Macros§

main
#[rustango::main] — the Django-shape runserver entrypoint. Wraps #[tokio::main] and a default tracing_subscriber initialisation (env-filter, falling back to info,sqlx=warn) so user main functions are zero-boilerplate:

Derive Macros§

Form
Derive rustango::forms::FormStruct (slice 8.4B). Generates a parse(&HashMap<String, String>) -> Result<Self, FormError> impl that walks every named field and:
Model
Derive a Model impl. See crate docs for the supported attributes.
Serializer
Derive rustango::serializer::ModelSerializer for a struct. (intra-doc link disabled — the macro crate doesn’t depend on rustango itself, so rustdoc can’t resolve the path.)
ViewSet
Derive a router(prefix, pool) -> axum::Router associated method on a marker struct, wiring the full CRUD ViewSet in one annotation.