Skip to main content

ri_app_builder_new

Function ri_app_builder_new 

Source
#[unsafe(no_mangle)]
pub extern "C" fn ri_app_builder_new() -> *mut CRiAppBuilder
Expand description

Creates a new CRiAppBuilder instance.

Initializes an empty application builder ready for component registration. The builder starts with default configuration and no registered modules.

§Returns

Pointer to newly allocated CRiAppBuilder on success. Never returns NULL as the implementation uses infallible construction. The returned pointer must be freed using ri_app_builder_free().

§Initial State

A newly created builder:

  • Has no registered modules
  • Has no configured middleware
  • Uses default application configuration
  • Has not initiated application startup

§Usage Pattern

CRiAppBuilder* builder = ri_app_builder_new();
if (builder == NULL) {
    // Handle allocation failure
    return ERROR_MEMORY_ALLOCATION;
}

// Register modules and configure
ri_app_builder_register_module(builder, http_module);
ri_app_builder_register_module(builder, database_module);

// Build and run
ri_app_builder_build(builder);

// Cleanup
ri_app_builder_free(builder);