Expand description

Interactive visual applications in Rust.

use sketchbook::*;
use sketchbook::ream::Single;

#[apply(derive_sketch)]
#[sketch(
    env = minimal,
    aspects = (/* aspects go here */),
)]
struct App {
    #[page] page: minimal::Page,
}

impl Setup for App {
    fn setup(page: minimal::Page, _: ()) -> Self {
        Self { page }
    }
}

fn main() {
    Book::<Single<App>>::bind();
}

Environments

CrateDescriptionStatus
sketchbook-wgpuDirectly uses winit and wgpu to run sketches.In Development
sketchbook-webRuns sketches in a web browser.Planned
sketchbook-avrRuns sketches on AVR micro-controllers (E.g. AVR based Arduinos)Planned

Feature Flags

  • default — No features are enabled by default.

Optional Components

Aspects
  • aspect-update — Aspect that periodically updates a sketch.

  • aspect-keyboard — Aspect for keyboard input.

  • aspect-mouse — Aspect for mouse input.

  • aspect-draw — Aspect for drawing onto the environment’s page.

Reams
  • ream-concurrent — Ream that runs multiple sketches without threads.

  • ream-parallel — Ream that runs multiple sketches on independant threads.

  • ream-single — Ream that runs a single sketch.

Environments
  • env-aspect-test — Macro for generating environments to test aspects.

  • env-minimal — Minimal environment that implements no aspects.

Optional Dependencies

  • std — Support for using the standard library.

  • alloc — Support for using allocation.

  • derive — Re-export macro_rules_attribute for better macro syntax.

  • color — Support for palette based colors.

  • serde — Support for serde.

Modules

Built-in aspects of environments.

Traits for generic composition.

minimalenv-minimal

Minimal environment for use in examples and tests.

Built-in reams to run sketches.

Macros

Create type composed of other types.

Implements the Sketch trait for a struct.

env_for_aspectenv-aspect-test

Macro to create environment for testing a single aspect.

Structs

A set of sketches.

Pages of a book.

2D point (x, y)

2D size (width, height)

2D vector (x, y)

Enums

Status flag

Traits

Environment for sketches to run in and interact with.

Factory for creating pages from an environment.

Trait for environment page.

Trait for real numbers.

Trait for setting up a sketch given some input.

Base trait for all sketches.

Convert to real number.

Type Definitions

Helper to get Event of type implementing the Environment trait.

Helper to get Mill of type implementing the Environment trait.

Helper to get Page of type implementing the Environment trait.

Attribute Macros

Re-export of macro_rules_attribute’s apply macro.