Skip to main content

s7_shortcut_name

Function s7_shortcut_name 

Source
pub(crate) fn s7_shortcut_name(
    class_name: &str,
    method_name: &str,
) -> Option<String>
Expand description

Name of the S7 fast-path shortcut <ClassName>_<method> (#949), or None when that name is not a syntactic R name.

A method whose R name is an operator (r_name = "[[", "%op%") is reached through R’s operator syntax (obj[[i]]), which dispatches through the generic. A shortcut named `Foo_[[` could only be called with backticks, so it is not emitted at all. Spell the method s7(generic = "[[") on a Rust method with an ordinary name to keep both the operator and a Foo_<name> shortcut. Shared by the inherent and trait S7 generators and the shortcut collision check, so all three agree on which names exist.