Module mica::ffvariants

source ·
Expand description

Variants of ForeignFunction.

This is a bit of a hack around Rust’s type system not supporting disjoint generic implementations. Each implementation has a corresponding marker type in this module, such that eg. the traits ForeignFunction<ffvariants::Fallible> and ForeignFunction<ffvariants::Infallible> are different, but can both be matched by using a generic parameter.

As long as all implementations are disjoint, Rust will happily infer all the types. If any implementations end up not being disjoint, that’s bad - Rust will complain about types being ambiguous, but that should be pretty easy to notice.

Structs

A bare fallible function.
A fallible function with RawSelf.
A fallible function with typed self.
Marker for a method that has an immutable self (&self).
A bare infallible function.
An infallible function with RawSelf.
An infallible function with typed self.
Marker for a method that has a mutable self (&mut self).

Enums

A bare varargs fallible function.
A bare varargs infallible function.

Traits

Marker trait for all functions that don’t accept a self reference as the first parameter and do not accept a variable number of arguments.
Marker trait for all functions that don’t accept a self reference as the first parameter, and may accept a variable number of arguments.
Marker trait for all functions that accept a self reference as the first parameter.
Defines the common Receiver type of ImmutableSelf and MutableSelf.