Skip to main content

validate_release_profile

Function validate_release_profile 

Source
pub fn validate_release_profile(
    panic: &str,
    lto: &str,
    opt_level: &str,
    codegen_units: &str,
) -> Result<ReleaseProfileCheck, ExtensionError>
Expand description

Validates release profile settings from string key-value pairs.

This function checks whether the given settings match the recommended release profile for DuckDB loadable extensions.

§Arguments

  • panic: The value of panic (e.g., "unwind", "abort")
  • lto: The value of lto (e.g., "true", "false", "fat", "thin")
  • opt_level: The value of opt-level (e.g., "3", "2", "s")
  • codegen_units: The value of codegen-units (e.g., "1", "16")

§Errors

Returns ExtensionError if the required setting (panic = "unwind") is not met.

§Example

use quack_rs::validate::validate_release_profile;

let check = validate_release_profile("unwind", "true", "3", "1").unwrap();
assert!(check.is_fully_optimized());

// `abort` makes quack-rs's panic handling inert — see the module docs.
assert!(validate_release_profile("abort", "true", "3", "1").is_err());