pub fn confirm_capacity(
label: &str,
actual: usize,
expected: usize,
) -> Result<(), KernelError>Expand description
Validates that actual capacity matches expected capacity for kernel operations.
Validation function used throughout the kernel library to ensure data structure capacities are correct before performing operations. Prevents buffer overruns and ensures memory safety by catching capacity mismatches early with descriptive error messages.
§Parameters
label: Descriptive label for the validation context (used in error messages)actual: The actual capacity of the data structure being validatedexpected: The expected capacity required for the operation
§Returns
Ok(()) if capacities match, otherwise KernelError::InvalidArguments with detailed message.
§Error Conditions
Returns KernelError::InvalidArguments when actual != expected, providing a clear
error message indicating the mismatch and context.