Crate pixelflut

Source
Expand description

§rust-pixelflut, a pixelflut client and server library

crates.io Released API docs MIT licensed Github

A sync and async implementation of the Pixelflut protocol for Rust.

§Usage

Import in rust project:

[dependencies]                                                                  
pixelflut = "0.2.0-alpha.2"

§Feature flags

  • image: Enable support for color types used in the image crate
  • tokio-rt: Enable support for the async client/server

§Performance

The async client archived >450MByte/s to localhost on an Apple m1. The server code needs improvement.

If you want to send data faster, spawn multiple clients or use the internal PixelBuffer if you want to send allways the same data.

§Example

extern crate pixelflut;
extern crate tokio;
use pixelflut::async_tokio::PixelflutClient;
use std::net::SocketAddr;

#[tokio::main]
async fn main() {
    let addr: SocketAddr = "127.0.0.1:1337".parse().unwrap();
    let mut pixelflut = PixelflutClient::connect(addr).await.unwrap();
    println!("{:?}", pixelflut.dimensions().await.unwrap());
    pixelflut.set(1, 2, (255, 0, 0)).await.unwrap();
    pixelflut.flush().await.unwrap();
}

§License

This project is licensed under the MIT license.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in rust-pixelflut by you, shall be licensed as MIT, without any additional terms or conditions.

Modules§

async_tokiotokio-rt
The async Tokio implementation of pixelflut.
syncsync
The sync implementation of pixelflut.

Structs§

Color
RGB color type with optional alpha channel
Coordinate
coordinate on a pixelflut grid
Pixel
Pixelflut pixel containing a coordinate and a color
PixelBuffer
Pixel buffer is a byte buffer that guarantees to contain valid pixelflut data. It is used as an internal buffer for the sync and async clients and can also be used for pre-format an array of pixels, as the PixelBuffer can direclty be send with a client.
PixelflutError
Pixelflut error type

Enums§

PixelflutErrorKind

Type Aliases§

PixelflutResult
Pixelflut Result alias