Skip to main content

PortReader

Trait PortReader 

Source
pub trait PortReader {
    // Required methods
    fn port(&self, name: &str) -> Option<Value>;
    fn as_any(&self) -> &dyn Any;
}
Expand description

The optional uniform read accessor a generated native ports struct implements so a consumer that does not downcast can still read ports by name. Reading a statically-typed field this way clones/boxes ONLY that one field into a Value on demand (no Vec, no eager boxing of every port) — a hot-path consumer downcasts (as_any) and reads the typed fields directly.

Required Methods§

Source

fn port(&self, name: &str) -> Option<Value>

The Value for a port name, and whether it is a declared port of this node.

Source

fn as_any(&self) -> &dyn Any

Downcast hook for a consumer that reads the concrete generated struct with zero boxing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§