Skip to main content

WireKey

Trait WireKey 

Source
pub trait WireKey: Sealed {
    // Required method
    fn resolve<M: Metadata + ?Sized>(self, metadata: &M) -> Option<usize>;
}
Expand description

A wire reference — either a pre-resolved index (fast path) or a name (resolved against the context’s input map).

Lets get_wire accept either form so callers can hold an index when they have one and a name when they don’t, without needing two distinct method names.

Sealed: only the in-crate impls (usize, &str, String) are valid wire keys. External implementors are not permitted because the resolution semantics are tied to the context’s input layout.

Required Methods§

Source

fn resolve<M: Metadata + ?Sized>(self, metadata: &M) -> Option<usize>

Resolve to a wire index in metadata. Returns None when the key doesn’t match a wire on this context.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl WireKey for &String

Source§

fn resolve<M: Metadata + ?Sized>(self, metadata: &M) -> Option<usize>

Source§

impl WireKey for &str

Source§

fn resolve<M: Metadata + ?Sized>(self, metadata: &M) -> Option<usize>

Source§

impl WireKey for String

Source§

fn resolve<M: Metadata + ?Sized>(self, metadata: &M) -> Option<usize>

Source§

impl WireKey for usize

Source§

fn resolve<M: Metadata + ?Sized>(self, _: &M) -> Option<usize>

Implementors§