pub fn get_desired_or_next_id(
array: &[Value],
id_field: &str,
desired_id: Option<i64>,
min_value: i64,
) -> Result<i64>Expand description
Get the next available ID or use desired ID if specified and available
Matches Python’s getDesiredValueOrNext behavior:
- If desired_id is Some and available, returns it
- If desired_id is Some but taken, returns error
- If desired_id is None, returns next available ID
§Arguments
array- Array of configuration itemsid_field- Name of the ID field (e.g., “DSRC_ID”, “ATTR_ID”)desired_id- Optional user-specified IDmin_value- Minimum value to return (e.g., 1000 for user items)
§Returns
ID to use (either desired_id or next available)
§Errors
Returns error if desired_id is already taken