Skip to main content

all_equal_fragments

Function all_equal_fragments 

Source
fn all_equal_fragments(
    entries: &[AllEqualEntry],
    classes: &[ClassNameEntry],
) -> Result<Vec<WrapperFragment>, String>
Expand description

The all.equal() methods of #[derive(AllEqual)] as fragments (#2149): each named all.equal.<Class> for the R class of the type’s ClassNameEntry, on its own page, and registered with S3method(all.equal, <Class>), which an env, R6, S3 or S4 object dispatches on (S4 through R’s S3 dispatch on the S4 class, which also reaches callers of base::all.equal() such as testthat, where an S4 method would not). An S7 object’s class attribute is pkg::Class, so an S7 class also registers the method with S7::method(all.equal, Class), followed by the unbinding every such replacement call on a base generic needs (see miniextendr_macros’s s7_base_operator_unbind).

The fragments are written with the trait impls, after every class definition, which the S7 registration names.

Every problem is collected into one message: a type no impl block gives an R class, and a vctrs class, whose objects are R vectors with no pointer to the Rust value.