Crate cala

Source
Expand description

Cala

Cala Build Status cala on crates.io Discord
Website | GitHub | Changelog | Tutorials

§Getting Started

Each module needs to be enabled with a feature. For example, if you want to use the task module, put this in your Cargo.toml:

[dependencies.cala]
version = "0.8"
features = ["task"]

Here’s the boilerplate for your main.rs:

use cala::task::{exec, wait, never};

/// The program's shared state.
struct State {}

/// Event handled by the event loop.
enum Event {
    Never(()),
}

impl State {
    /// Event loop.
    fn event(&mut self, event: Event) {
        match event {
            Event::Never(_) => unreachable!(),
        }
    }
}

/// Start the async executor.
fn main() {
    let mut state = State {};
    let mut never = never();

    exec!(state.event(wait! {
        Event::Never((&mut never).await),
    }));
}

Module documentation may include simple tutorials. More in depth tutorials may be found here.

§A Tour of Cala

The rest of this crate documentation is dedicated to pointing out notable features of the Cala crate.

§Containers and Collections

The audio and video modules contain multimedia types for working with sounds and graphics.

§Platform Abstractions

The task module contains abstractions for dealing with asynchronous code.

The gui module contains abstractions for making a GUI (Graphical User Interface).

§I/O

Cala’s main purpose is to abstract over differences in common platforms, notably Windows, Web, and Unix derivatives (including mobile) for things that the standard library does not. This is mostly with multi-media I/O, defined in these modules:

  • bluetooth - bluetooth
  • camera - webcam, phone camera
  • client - client network communication
  • database - database for persistent storage
  • graphics - hardware-accelerated graphics rendering
  • haptic - haptic force feedback
  • info - system environment information
  • input - user input.
  • log - message logging
  • microphone - microphone input
  • port - general purpose I/O ports
  • random - random number generators
  • server - server network communication
  • speakers - speaker output
  • timer - using timers
  • usb - universal serial bus communcations
  • when - getting the current time
  • window - display graphics in an area on a screen.

Modules§

  • Audio types.
  • Bluetooth and Bluetooth Low Energy communication. (WIP)
  • Acess to webcam, selfie-camera, front-facing camera, etc. (WIP)
  • Client fetch API. (WIP)
  • Save and load data to persistent storage.
  • Render (draw) graphics using the GPU and/or SIMD.
  • Create, layout and draw widgets (WIP)
  • Haptic force feedback.
  • Retrieve environment information.
  • User Input.
  • Text output through some medium (stdout, web console, serial, etc.)
  • Audio capture (recording) device
  • General purpose I/O (WIP)
  • Generate random numbers.
  • Server API. (WIP)
  • Audio playback device
  • Execution of asynchronous tasks.
  • Asynchronous timers (WIP)
  • Serial communication.
  • Video types.
  • API for getting the date and time of day.
  • Display graphics onto the screen, usually via a window.

Macros§

  • Insert glue code so that your application can run on WASM and Android.