Crate starlark_derive

source ·
Expand description

A proc-macro for writing functions in Rust that can be called from Starlark.

Macros§

  • Generate {has,get,dir}_attr in the StarlarkValue impl block that proxy to the ones generated by derive(StarlarkAttrs)

Attribute Macros§

Derive Macros§

  • Derive the Freeze trait.
  • Derive the NoSerialize trait for serde.
  • Derive the ProvidesStaticType trait. Requires the type has no type arguments, no constant arguments, and at most one lifetime argument.
  • Derive accessor methods that are designed to be used from {has,get,dir}_attr in an impl StarlarkValue block. All fields in the struct that are not marked with #[starlark(skip)] are exported to Starlark code as attributes. NOTE: Any usage must also call starlark_attrs!() in the impl block for StarlarkValue, otherwise the generated attr methods will not be used.
  • Generate an accessor function on the provided type that returns its documentation based on StarlarkValue::get_methods(). This macro requires that the type implements starlark::StarlarkValue.
  • Derive the StarlarkTypeRepr trait.
  • Derive the Trace trait.
  • Derive the UnpackValue trait.