Introduction
It’s just a tool library.
If you just want to use the library, check out Getting Started.
If you would like to join the development, please check out the design documentation.
Getting Started
Design Documentation
This is the design documentation for the project. If you are not familiar with the project, please read the Getting Started first.
Design Goals
Design a modular, ergonomic, and universal tool library
Architecture
See Architecture
Task System
See Task System
I18n
Backends
fluent-rs: https://projectfluent.org/
Task System
Task Priority
- Realtime
- High
- Normal
- Low
- Idle
Task Scheduler
- System
SIMD
fn main() {
let datas = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
datas.simd_task_iter()
.add(1)
}
Pipeline
use algosul::cpu::task::prelude::v1::*;
fn main() {
let datas = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
datas.task_iter()
.filter(|x| x % 2 == 0)
.sync_task(100)
.map(|x| x * 10)
}
Commands
Rust Derive
Undo/Redo
Modules
Module Manager
register_module- return:
Module ID
Module Private ID
Messages
Message Type
Basic type, does not support sending:
DebugInfoWarnError
To define message types, you must choose to inherit from a message type
Message Content
Needs to implement Message Trait
Message Metadata
- Status (
status):SucceedFailed
- Process (
process): 0% ~ 100%- Progress detail (
progress_detail):0/32,loading...
- Progress detail (
Message Sender
- Message Type
- Message Content
- Sending time
- Private ID of the message sending module (
sending_module_key): Needs Module Private ID - Message Metadata
Message
- Message Type
- Message Content
- Sending time
- ID of the message sending module (
sending_module_id): Module ID - Message Metadata
Message interface
- Send message function
- Register message type functions
- Register the message hook function
Message Trait
Application
Applications
Rust
Dependencies
- Target
- I/O
- toml (https://crates.io/crates/toml)
- serde (https://crates.io/crates/serde)
Mirrors
Install Rust
Reference: https://forge.rust-lang.org/infra/other-installation-methods.html
Standalone Installers (Rustup)
- Check the system environment
- List Rust versions (
https://static.rust-lang.org/dist/channel-rust-stable.toml) - Download the installation package for the corresponding version.
(
https://static.rust-lang.org/rustup/dist/{TARGET_TRIPLE}/rustup-init{.exe?}) - Install to the designated location
- Check the installation status
Standalone Installers (No Rustup)
- Check the system environment
- List Rust versions (
https://static.rust-lang.org/dist/channel-rust-stable.toml) - Download the installation package for the corresponding version.
(
https://static.rust-lang.org/rustup/dist/rustc-{VERSION}-{TARGET_TRIPLE}.tar.xz) - Unzip the installation package
- Install to the designated location
- Check the installation status
Source Code (No Rustup)
- Choose Host Rust versions
- Check the system environment
- List Rust Source versions (
https://static.rust-lang.org/dist/channel-rust-stable.toml) - Download the source code (
https://static.rust-lang.org/dist/rustc-{VERSION}-src.tar.xz) - Unzip the source code
- Compile the source code
- Install to the designated location (or system link)
- Check the installation status
Uninstall Rust
Rustup
- Run
rustup self uninstall - Check the uninstallation status
Source Code
- Remove the installation files (or system link)
- Clean the source code directory (optional)
- Check the uninstallation status
Update Rust
Rustup
- Run
rustup update
Source Code
- Choose Host Rust versions
- Check the system environment
- List Rust Source versions (
https://static.rust-lang.org/dist/channel-rust-stable.toml) - Download the source code (
https://static.rust-lang.org/dist/rustc-{VERSION}-src.tar.xz) - Unzip the source code (Overwrite)
- Compile the source code
- Install to the designated location (or system link)
- Check the installation status
LLVM
GCC
Python
GDB
LLDB
Git
Jujutsu
Version
Authors
Derive
User Interface(UI)
v1
#![allow(unused)]
fn main() {
use std::net::SocketAddr;
use std::time::Duration;
use algosul::ui::*;
use algosul::derive::*;
#[derive(UI, DataSync)]
#[ui(key = "time-sync", widget = "Taps::new()")]
enum TimeSync {
#[ui(title_key = "unknown")]
#[ui_cfg(class = "show", widget = "Text::new()")]
#[ui_cfg(class = "input", ignore)]
Unknown,
#[ui(title_key = "no-sync")]
No,
#[ui(title_key = "auto-sync")]
Auto {
url: String,
refresh_duration: Duration,
}
}
}
v2
- async +
Rc<RefCell<T>> SenderandReceiver
#![allow(unused)]
fn main() {
use algosul::{ui::*, derive::*};
#[derive(DataSync)]
enum TimeSync {
Unknown,
No,
Auto {
url: String,
refresh_duration: Duration,
}
}
impl Widget for TimeSync {
fn build(&self) -> Box<dyn Widget> {}
}
}
Utilities
Process
I/O
Virtual File System (VFS)
| Type | Identifier |
|---|---|
| File System | FileSystem |
| Path | Path |
| File | File |
| Directory | Directory |
| Device | Device |
| Socket | Socket |
Base Directory
See XDG Base Directory Specification
Regardless of the platform, check the environment variable XDG_XYZ_ABC,
If it exists, use the folder defined by the environment variable,
Otherwise, use the platform’s default folder
All paths set in these environment variables must be absolute. If an implementation encounters a relative path in any of these variables it should consider the path invalid and ignore it.
Variables that may be used:
{USER}: Username (Unix-like: environment variableUSER,Windows: environment variableUSER_NAME){UID}: User ID (Only inUnix-like){APP_NAME}: Application Name{APPDATA}: environment variableAPPDATA(Only inWindows){LOCALAPPDATA}: environment variableLOCALAPPDATA(Only inWindows)
User-specific Data
XDG: XDG_DATA_HOME:
Unix-like:~/.local/share/{APP_NAME}Windows:{APPDATA}/{APP_NAME}/dataMacOS:~/Library/Application Support/
User-specific Configuration
XDG: XDG_CONFIG_HOME
Unix-like:~/.config/{APP_NAME}Windows:{APPDATA}/{APP_NAME}/configMacOS:~/Library/Preferences/
User-specific State Data
XDG: XDG_STATE_HOME:
Unix-like:~/.local/state/{APP_NAME}Windows:{LOCALAPPDATA}/{APP_NAME}/stateMacOS:~/Library/Application Support/
User-specific Cached Data
XDG: XDG_CACHE_HOME:
Unix-like:~/.cache/{APP_NAME}Windows:{LOCALAPPDATA}/{APP_NAME}/cacheMacOS:~/Library/Caches/
User-specific Runtime Files
XDG: XDG_RUNTIME_DIR:
Linux:/run/user/{UID}Windows:%TEMP%MacOS:$TMPDIRUnix-like:/var/run/user/{UID}
System Runtime Files
Similar to this
rust:std::env::temp_dir()
Linux:/tmpAndroid: Decided by the system
Windows:GetTempPath2/GetTempPathMacOS:confstr(_CS_DARWIN_USER_TEMP_DIR, ...)Unix-like:/tmp
Async
Process
%%{
init: {
'theme': 'redux dark',
}
}%%
graph BT
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
ACommand[AsyncCommand]
AChild[AsyncChild]
AIsTerminal{AsyncIsTerminal}:::interface
I/O
%%{
init: {
'theme': 'redux dark',
}
}%%
graph BT
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
ARead{AsyncRead}:::interface
ABufRead{AsyncBufRead}:::interface
AWrite{AsyncWrite}:::interface
ASeek{AsyncSeek}:::interface
Target
Introduction
‘target’ indicates the target platform on which the software runs
includes:
Specification
Architectures
| bits | 32 | 64 |
|---|---|---|
| x86 | i586/i686 | x86_64 |
| aarch | arm (aarch32) | aarch64 |
| loongarch | loongarch32 | loongarch64 |
| riscv | riscv32imac | riscv64gc |
Operating Systems (OS)
Unix
linux: Linux
- android: Google Android
- unknown: Others
apple: Apple
- darwin: macOS
- ios: iOS
- watchos: Apple Watch OS
- tvos: Apple TV OS
- visionos: Apple Vision OS
BSD
- unknown-freebsd: FreeBSD
- unknown-netbsd: NetBSD
- unknown-openbsd: OpenBSD
Windows
- pc-windows: Windows
- uwp-windows: Windows Universal Platform
Vendor
ABI
Data Layout
Adapter
LLVM Target
<arch>-<vendor>-<os>-<abi>
Rust Target
<arch>-<vendor>-<os>-<abi>
Math
User Interface (UI)
View
Cargo Plugin (cargo-algosul)
Project Manage
Project Init
Project Build
Project Test
Project Clean
Project Run
Project Debug
IDE Plugins
IDEA (IntelliJ) Plugin
VSCode Plugin
Architecture
It is recommended to use dark themes
1. Overall Architecture
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
Core:::core
I18n:::core
Modules:::modules
Messages:::messages
CPU:::api
GPU:::api
NPU:::api
UI:::ui
AI:::ai
AI --> NPU & GPU & CPU --> Messages
UI --> GPU & CPU --> Messages
Messages --> Modules --> I18n --> Core
UI
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
UI:::ui
UIFramework[UI Framework]:::ui
UIBackend{UI Backend}:::interface
DefaultUIBackend[Default UI Backend]:::ui
RenderPipeline[Render Pipeline]:::ui
RenderPipelineInterface{Render Pipeline Interface}:::interface
DefaultUIBackend --> UIBackend
DefaultUIBackend --> RenderPipeline
UI --> UIBackend & UIFramework
RenderPipeline --> RenderPipelineInterface
Backends
algosul::cpualgosul::gpuQt 6Gtk 4WinUI 2
AI
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
AI:::ai
AIInference[AI Inference]:::ai
AIInferenceInterface{AI Inference Interface}:::interface
AI --> AIInference
AIInference --> AIInferenceInterface
Render
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
CPURenderPipeline[CPU Render Pipeline]:::ui
GPURenderPipeline[GPU Render Pipeline]:::ui
RenderPipelineInterface{Render Pipeline Interface}:::interface
CPU:::api
GPU:::api
CPURenderPipeline & GPURenderPipeline --> RenderPipelineInterface
CPURenderPipeline ---> CPU
GPURenderPipeline ---> GPU
AI Inference
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
CPUAIInference[CPU AI Inference]:::ai
GPUAIInference[GPU AI Inference]:::ai
AIInferenceInterface{AI Inference Interface}:::interface
CPU:::api
GPU:::api
CPUAIInference & GPUAIInference --> AIInferenceInterface
CPUAIInference ---> CPU
GPUAIInference ---> GPU
CPU
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
CPU:::api
Task{Task System}:::interface
CPU -..-> Task
GPU
%%{
init: {
'theme': 'redux dark',
}
}%%
graph TB
classDef interface fill:#822, stroke: #f88,stroke-width:2px,stroke-dasharray: 5 5, color: #fff;
classDef core fill:#828, stroke: #f8f, stroke-width:2px, color: #fff;
classDef modules fill:#228, stroke: #88f,stroke-width:2px, color: #fff;
classDef messages fill:#882, stroke: #ff8,stroke-width:2px, color: #fff;
classDef api fill:#282, stroke: #8f8,stroke-width:2px, color: #fff;
classDef ai fill:#288, stroke: #8ff,stroke-width:2px, color: #fff;
classDef ui fill:#852, stroke: #fb8,stroke-width:2px, color: #fff;
GPU:::api
Cuda:::api
Vulkan:::api
DirectX:::api
Task{Task System}:::interface
GPU --> Vulkan & DirectX & Cuda
GPU -..-> Task
Vulkan & DirectX -.-> Cuda