Notification demon + web server using async Rust

Related tags

Database rust async
Overview

Async Rust example

Road to the asynchronous Rust

Table of Contents

About the Project

Screenshots

notif daemon example

Tech Stack

Features

Notification daemon

  • usign D-Bus for catching notifications.
  • using tokio for async.
  • draw simple but stylish boxes around notifications.
  • supports window resizing.
  • supports immortal notifications as well as mortal.
  • supports all apps using D-Bus interface.

Web server

  • serving requests concurrently.

Getting Started

Prerequisites

Install rustup:

Read "Installation" from 'The Rust Programming Language' book.

Clone and run

$ git clone https://github.com/khadievedem/rust_async.git
$ cd rust_async

Run notification daemon project with

$ cargo run --bin notification_daemon

or web server

$ cargo run --bin web_server

Usage

Web Server

localhost:7878/

hello world page ./web_server/src/hello.html

localhost:7878/sleep

sleep for a 10 seconds (in order to test concurrency)

localhost:7878/smthfkwejfllkdk

Ooops! :-) ./web_server/src/404.html

Notification daemon

Run the app according to Clone & Run section.

press 'q' to exit.

Roadmap

Zero stage

  • Huge absorption of information about programming in Rust.
  • Read Rust async-book.

First stage

  • Create web-server following guide in the Rust async-book.
  • Migrate from async-std to tokio (web-server)
  • Brainstorm on example project topics.
  • Decide which project will best demonstrate async working (under Linux)

See more about my decision at: FAQ section

Second stage

  • Read how communication between apps works in Linux.
  • Study the D-Bus Notifications Specification.
  • Create simple application using zbus (crate for D-Bus)
  • Write an interface for catching notifications.
  • Brainstorm on showing notifications to the user.
  • Unsafe QT drawing attempts.
  • GTK drawing attempts.

See about problems with GUI at: FAQ section

  • TUI drawing using console-engine.

Third stage

  • Brainstorm on concurrent connection of drawing and catching notifications.
  • Async notification catching.
  • Async notification boxes drawing.
  • Set up communication between catcher and drawer using tokio mspc channel.

FAQ

Why did you choose the notification daemon?

My very first idea was to implement my own Windows Manager. But there was one major problem - asynchronous Windows Manager sounds really weird, it must use multithreading. So I started looking for other interesting ideas to implement.
Notification daemon was selected, because in addition to async programming I learn in detail D-Bus, as well as writing an application that interacts with other programs.

Why didn't you implement the GUI? The TUI doesn't look very useful.

As you can see in qt-notifications branch I've tried to implement graphical notificaitons using qt as well as gtk. But I faced a problem connected with my Windows Manage (I use 'sway' BTW). Tiling WMs can't draw a pop-up window in the corner. Instead they draw it right in the center. To draw notifications in the corner, I would have to work with winit, but that would take a very long time. After all, the main goal of the project -> learn async Rust, not to work with graphics. That's why I chose the Terminal application.

Contact

Edem Khadiev - Telegram - [email protected]

You might also like...
Quick Pool: High Performance Rust Async Resource Pool

Quick Pool High Performance Rust Async Resource Pool Usage DBCP Database Backend Adapter Version PostgreSQL tokio-postgres qp-postgres Example use asy

High-level async Cassandra client written in 100% Rust.
High-level async Cassandra client written in 100% Rust.

CDRS tokio CDRS is production-ready Apache Cassandra driver written in pure Rust. Focuses on providing high level of configurability to suit most use

Automatically deleted async I/O temporary files in Rust

async-tempfile Provides the TempFile struct, an asynchronous wrapper based on tokio::fs for temporary files that will be automatically deleted when th

Go like sync.WaitGroup implementation in Rust. (sync/async)

WAG Go like sync.WaitGroup implementation in Rust. (sync/async) | Examples | Docs | Latest Note | wag = "0.3.0" How to use, use wag::WaitGroup; let w

An async Rust client for SurrealDB's RPC endpoint

An async Rust client for SurrealDB's RPC endpoint This crate serves as a temporary yet complete implementation of an async Rust client to connect to a

An async-ready Phoenix Channels v2 client library in Rust

Phoenix Channels This crate implements a Phoenix Channels (v2) client in Rust. Status NOTE: This client is still a work-in-progress, though it has eno

Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe
Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe

redi-rs (or redirs) redi-rs is a Lightweight Redis client with connection pooling written in Rust and 100% memory safe redi-rs is a Redis client writt

Plugin for macro-, mini-quad (quads) to save data in simple local storage using Web Storage API in WASM and local file on a native platforms.

quad-storage This is the crate to save data in persistent local storage in miniquad/macroquad environment. In WASM the data persists even if tab or br

An async executor based on the Win32 thread pool API

wae An async executor based on the Win32 thread pool API use futures::channel::oneshot; #[wae::main] async fn main() { let (tx, rx) = oneshot::ch

Owner
Edem Khadiev
Edem Khadiev
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. ?? Looking for an async version? async-std https://github.c

Alex Pikalov 338 Jan 1, 2023
TDS 7.2+ (mssql / Microsoft SQL Server) async driver for rust

Tiberius A native Microsoft SQL Server (TDS) client for Rust. Supported SQL Server versions Version Support level Notes 2019 Tested on CI 2017 Tested

Prisma 189 Dec 25, 2022
rust_arango enables you to connect with ArangoDB server, access to database, execute AQL query, manage ArangoDB in an easy and intuitive way, both async and plain synchronous code with any HTTP ecosystem you love.

rust_arango enables you to connect with ArangoDB server, access to database, execute AQL query, manage ArangoDB in an easy and intuitive way, both async and plain synchronous code with any HTTP ecosystem you love.

Foretag 3 Mar 24, 2022
Dataloader-rs - Rust implementation of Facebook's DataLoader using async-await.

Dataloader Rust implementation of Facebook's DataLoader using async-await. Documentation Features Batching load requests with caching Batching load re

cksac 229 Nov 27, 2022
Async Lightweight HTTP client using system native library if possible. (Currently under heavy development)

Async Lightweight HTTP Client (aka ALHC) What if we need async but also lightweight http client without using such a large library like reqwest, isahc

SteveXMH 7 Dec 15, 2022
SubZero - a standalone web server that turns your database directly into a REST/GraphQL api

What is this? This is a demo repository for the new subzero codebase implemented in Rust. subZero is a standalone web server that turns your database

subZero 82 Jan 1, 2023
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

SQLx ?? The Rust SQL Toolkit Install | Usage | Docs Built with ❤️ by The LaunchBadge team SQLx is an async, pure Rust† SQL crate featuring compile-tim

launchbadge 7.6k Dec 31, 2022
Simple, async embedded Rust

Cntrlr - Simple, asynchronous embedded Cntrlr is an all-in-one embedded platform for writing simple asynchronous applications on top of common hobbyis

Branan Riley 11 Jun 3, 2021
Rust async runtime based on io-uring.

Monoio A thread-per-core Rust runtime with io_uring. 中文说明 Design Goal As a runtime based on io_uring, Monoio is designed to be the most efficient and

Bytedance Inc. 2.4k Jan 6, 2023
🐚 An async & dynamic ORM for Rust

SeaORM ?? An async & dynamic ORM for Rust SeaORM SeaORM is a relational ORM to help you build web services in Rust with the familiarity of dynamic lan

SeaQL 3.5k Jan 6, 2023