trait_exists()
function trait_exists(string $trait, bool $autoload = true): bool
Checks whether the trait exists.
Parameters:
$trait(string)$autoload(bool), defaulttrue, optional
Returns: bool
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/symbols/trait_exists.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how trait_exists is implemented in the compiler, see the internals page.