← Winnitude! Search  ·  Reader Mode (891 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 27 LINKS

Rust sketch API by tychedelia · Pull Request #284 · processing/libprocessing

Repository navigation

Rust sketch API - #284


Draft
tychedelia wants to merge 4 commits into processing:main from tychedelia:rust-api
Draft

Rust sketch API #284 tychedelia wants to merge 4 commits into processing:main from tychedelia:rust-api

Conversation

tychedelia commented Nov 20, 2026



Copy link Copy Markdown
Member

This adds a sketch API to the top-level processing crate, so a Rust sketch can look like a Processing sketch:

use processing::prelude::*;

struct MySketch;

impl Sketch for MySketch {
    fn settings() -> Settings {
        Settings::size(400, 400)
    }

    fn setup(_g: &mut Graphics) -> Result<Self> {
        Ok(MySketch)
    }

    fn draw(&mut self, g: &mut Graphics) {
        g.background(25);
        g.rect(g.mouse_x(), g.mouse_y(), 50, 50).radius(4);
    }
}

Some notes:

Functions with several signatures take tuples: fill(255), fill((255, 0, 0)), translate((x, y)). Optional arguments chain on the end, as with .radius() above.

Draw calls record straight away and return a small guard. The guard can still change the command it recorded until the next flush, where the engine tracks this with a command slot. push() and begin_shape() return guards that pop or end when they go out of scope. This is a style thing that we definitely can discuss more.

The engine re-exports that the bindings use moved from processing::prelude to processing::engine. prelude is now the sketch prelude. This is sa large mechanical change.

tychedelia added 4 commits November 18, 2026 13:58 Rust api. 4258e15 Rust. 0d1718b Rebase and more change.s bdfb95e Cleanup. 565a171 tychedelia changed the title Rust api Rust sketch API Nov 20, 2026

github-actions
Bot
commented Nov 20, 2026



Copy link Copy Markdown

Visual regression: 1 changed of 43 cases

case status detail
py_flocking_gpu ❌ changed 8% of pixels differ

If these changes are intentional, add the deliberate-rendering-change label.

baseline 1c92b8812a · adapter llvmpipe (LLVM 20.1.2, 256 bits) (Vulkan, Mesa 25.2.8-0ubuntu0.24.04.5 (LLVM 20.1.2))

Open the visual report · workflow run

This branch has not been deployed


No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

1 participant