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 theStarlarkValue
impl block that proxy to the ones generated byderive(StarlarkAttrs)
Attribute Macros§
- Stubs for Starlark bytecode interpreter.
- Write Starlark modules concisely in Rust syntax.
- Generate missing elements of
StarlarkValue
trait when this attribute is applied to an impl block ofStarlarkValue
.
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 callstarlark_attrs!()
in the impl block forStarlarkValue
, 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 implementsstarlark::StarlarkValue
. - Derive the
StarlarkTypeRepr
trait. - Derive the
Trace
trait. - Derive the
UnpackValue
trait.