pub trait Module<E: Element>: Send + Sync {
// Required method
fn express<'tape>(&self, input: Value<'tape, E>) -> Value<'tape, E>;
// Provided method
fn visit(&self, visitor: &mut dyn Visitor) { ... }
}Expand description
A named, parameterized recording function: the unit of model composition.
A module holds its parameters as detached Symbols and records
its formula through the public operation surface — it never owns
payloads (the caller’s Parameters do) and
never touches the engine.
Expression happens at record time, once per topology; the cost
never reaches a run, a plan, or a kernel, which is why composing
through dyn Module (see Sequential) sits
squarely inside the sanctioned dynamic-dispatch exceptions.
Programmatic access to a module’s parameters — tying, freezing,
inspection — goes through its typed accessors (weights(),
struct fields), never through names. Module::visit exists for
the serialization boundary alone, where checkpoints need stable
structured paths.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".