Skip to main content

generate_application_full

Function generate_application_full 

Source
pub fn generate_application_full(
    document: &DampenDocument,
    model_name: &str,
    message_name: &str,
    handlers: &[HandlerSignature],
    theme_document: Option<&ThemeDocument>,
    persistence: Option<&PersistenceConfig>,
) -> Result<CodegenOutput, CodegenError>
Expand description

Generate complete application code with theme, subscription, and persistence support

This is the most complete entry point for code generation that includes:

  • Message enum with system theme variant (if follow_system is enabled)
  • Subscription function for system theme detection
  • Theme code generation
  • View and update functions
  • Window settings function for persistence (if persistence config is provided)
  • Full window event handling for persistence (tracking size, position, save on close)

§Arguments

  • document - Parsed Dampen document
  • model_name - Name of the model struct (e.g., “Model”)
  • message_name - Name of the message enum (e.g., “Message”)
  • handlers - List of handler signatures
  • theme_document - Optional theme document for theme code generation
  • persistence - Optional persistence configuration for window state

§Returns

Ok(CodegenOutput) with generated code and warnings