pub trait Functor<O1, A1, O2, A2> {
// Required methods
fn map_object(&self, o: &O1) -> impl ExactSizeIterator<Item = O2>;
fn map_operation(
&self,
a: &A1,
source: &[O1],
target: &[O1],
) -> OpenHypergraph<O2, A2>;
fn map_arrow(&self, f: &OpenHypergraph<O1, A1>) -> OpenHypergraph<O2, A2>;
}
Expand description
An easier-to-implement Functor
trait for lax OpenHypergraph
Required Methods§
Sourcefn map_object(&self, o: &O1) -> impl ExactSizeIterator<Item = O2>
fn map_object(&self, o: &O1) -> impl ExactSizeIterator<Item = O2>
Map a generating object of the theory
Sourcefn map_operation(
&self,
a: &A1,
source: &[O1],
target: &[O1],
) -> OpenHypergraph<O2, A2>
fn map_operation( &self, a: &A1, source: &[O1], target: &[O1], ) -> OpenHypergraph<O2, A2>
Map a single operation of the theory with specified source and target type.
This must be consistent with map_object
, i.e. we must have:
- F.map_operation(x, s, t).sources == F.map_object(s)
- F.map_operation(x, s, t).targets == F.map_object(t)
This condition is not checked, but may panic if not satisfied.
Sourcefn map_arrow(&self, f: &OpenHypergraph<O1, A1>) -> OpenHypergraph<O2, A2>
fn map_arrow(&self, f: &OpenHypergraph<O1, A1>) -> OpenHypergraph<O2, A2>
Apply this functor to an OpenHypergraph
.
Once map_operation
is defined, this can typically be defined as
define_map_arrow(self, f)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.