vcraft does for V what PyO3 and maturin do together for Rust: the bindings, the build
and the wheel. Most concepts map one to one; the main difference is that vcraft has no
API to call for marshalling. You annotate ordinary V declarations and the generator
writes the glue, so a signature such as fn f(xs []f64) !f64 is the whole binding.
@[vc_method] pub fn (t &T) m() (mut t T to modify)
#[getter] / #[setter]
@[vc_property] / @[vc_property_set]
#[staticmethod] / #[classmethod]
@[vc_static] / @[vc_classmethod]
#[pyclass(extends = Base)]
@[vc_base(Base)]
#[pyclass(frozen, eq, hash)]
@[vc_eq] and @[vc_hash] functions
__str__, __call__, __bool__
@[vc_str], @[vc_call], @[vc_bool]
__len__, __getitem__, __contains__
@[vc_len], @[vc_getitem], @[vc_contains]
__iter__ / __next__
@[vc_iter] / @[vc_next]
__add__, __lt__, …
@[vc_add], @[vc_lt], … (and @[vc_radd], …)
__getattr__ / __setattr__
@[vc_getattr] / @[vc_setattr]
Py<Other> field
@[vc_ref] field
#[pyclass(dict)], __match_args__
__match_args__ is generated from the fields
__getbuffer__
@[vc_buffer] field, @[vc_memoryview] result
Fields are scalars; V-managed state (maps, arrays, strings) lives behind a
@[vc_handle] vcraft.Owned made with vcraft.own_gc(...), because V's collector cannot
see memory CPython allocated (see Classes).
Memory. V objects are collected by V's own Boehm collector, which runs inside the
extension and follows Python's gc.collect(); there are no lifetimes or Py<T>
handles to manage. str arguments are borrowed for the call: .clone() what you keep.
Toolchain. One pinned V compiler, installed into vcraft's cache by
vcraft toolchain install; no Cargo, no Rust, no zlib.
Gaps. What PyO3 has and vcraft does not is listed in
LIMITATIONS.md, and the
decisions not to add something are in
DECISIONS.md.