Skip to main content

generate_altrep_len

Function generate_altrep_len 

Source
fn generate_altrep_len(
    name: &Ident,
    generics: &Generics,
    len_field: &Ident,
) -> TokenStream
Expand description

Generates an impl AltrepLen for T block that delegates to a named struct field.

The generated implementation returns self.{len_field} cast to usize as the ALTREP vector length.

ยงArguments

  • name โ€“ The struct identifier.
  • generics โ€“ Generic parameters for the struct.
  • len_field โ€“ The identifier of the field that holds the length value.