Add debug assertion for custom feature namespaces
This commit is contained in:
parent
7c732e594c
commit
d9284ef0b7
1 changed files with 13 additions and 1 deletions
|
@ -85,7 +85,19 @@ impl ClapFeature {
|
|||
ClapFeature::Stereo => "stereo",
|
||||
ClapFeature::Surround => "surround",
|
||||
ClapFeature::Ambisonic => "ambisonic",
|
||||
ClapFeature::Custom(s) => s,
|
||||
ClapFeature::Custom(s) => {
|
||||
// Custom features must be prefixed with a namespace. We'll use `.split(':').all()`
|
||||
// here instead of `.split_once()` in case the user for whatever reason uses more
|
||||
// than one colon (which the docs don't say anything about, but uh yeah).
|
||||
nih_debug_assert!(
|
||||
s.contains(':') && s.split(':').all(|x| !x.is_empty()),
|
||||
"'{s}' is not a valid feature, custom features must be namespaced (e.g. \
|
||||
'nih:{s}')",
|
||||
s = s
|
||||
);
|
||||
|
||||
s
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue