pub struct Overload {
pub name: &'static str,
pub forms: &'static [OverloadForm],
}Expand description
A function name that stands for one node per argument type, as
vec_dot stands for vec_dot_f32 and vec_dot_f64
(polydat_grammar.md §18.1, T-Call-OverloadResolve).
A call to the name builds the form that agrees with the most of the
call’s wire types, position by position, and the earliest such form
when several agree with as many: the form matching every type when
one does. The assembler’s adapters then reach the form’s other
ports, as they reach any node’s. So vec_scale(v, 2) over a
vec_f64 builds the f64 form and widens the integer, rather than
narrowing the vector to reach a form that takes neither operand as
given. The first form is the one the name meant before it had others,
so operands no form agrees with build it, and a program that
compiled against the name still does. A node module submits one at
link time:
polydat::inventory::submit! {
polydat::dsl::registry::Overload {
name: "vec_dot",
forms: &[
OverloadForm { wires: &[PortType::VecF32, PortType::VecF32], func: "vec_dot_f32" },
OverloadForm { wires: &[PortType::VecF64, PortType::VecF64], func: "vec_dot_f64" },
],
}
}Every form takes the same parameters in the same order, so the name’s parameters are those of any form; only the wires’ types differ.
Fields§
§name: &'static strThe name programs call.
forms: &'static [OverloadForm]The forms the name resolves to, the default first.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Forget for Overload
impl Freeze for Overload
impl RefUnwindSafe for Overload
impl Send for Overload
impl Sync for Overload
impl Unpin for Overload
impl UnsafeUnpin for Overload
impl UnwindSafe for Overload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more