Attribute Macro anchor::klipper_command

#[klipper_command]
Expand description

Creates protocol command handler

This attribute is put on functions that should be exposed to the remote end. Only free standing functions are supported.

An example usage:

#[klipper_command]
fn finalize_config(context: &mut State, crc: u32) {
  ...
}

Argumenst are automatically converted to protocol compatible types and from wire format back to Rust values.

A context argument may optionally be included. If included, this argument must be called context or ctx and must be the first argument. It must have a type matching the one given as the context parameter to the klipper_config_generate macro.

The following types are supported: u8, i16, u16, i32, u32, bool, &[u8].

While Anchor places no restrictions on the number of arguments, be aware that individual messages in the protocol are limited to 64 bytes of length. For larger sized data, one must split the data across multiple messages.