pub trait Params {
// Required methods
fn number(&self, key: &str) -> Option<f64>;
fn word(&self, key: &str) -> Option<String>;
}Expand description
Where an effect’s parameters come from.
A trait rather than a map, because the same parameters arrive from a Lua
table in the compositor, from a slider in the preview, and from a literal
in a test – and this crate may not depend on any of the three. Every
parameter is optional and every effect has a default for each of its own,
which is what makes { effect = "genie" } on its own a legal thing to
write.
What this cannot do is complain. A parameter that is missing, misspelled or
the wrong type is indistinguishable here from one nobody wrote, and there
is no logger to say so – so both give the default. The check that catches
it is script::shipped, which reads the names out of this crate and fails
the build when the shipped Lua asks for one that does not exist.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".