#scsys #primitive #toolkit #utilities

no-std scsys-config

common configuration routines and schemas used throughout the ecosystem

3 releases

Uses new Rust 2024

new 0.2.7 May 23, 2025
0.2.6 May 22, 2025
0.2.5 May 21, 2025

#306 in Configuration

Download history 357/week @ 2025-05-19

357 downloads per month
Used in scsys

Apache-2.0

120KB
3K SLoC

scsys

crates.io docs.rs GitHub License


Warning: the library is still in the early stages of development so make sure to use with caution!

Welcome to scsys, a collection of useful utilities, types, and other primitives that are used in various projects developed by Scattered Systems. The library is designed to be a general-purpose utility library that can be used in any Rust project, aiming to provide a standardized set of tools that can be used to build robust and reliable software.

Usage

Before you start using scsys, make sure to add it as a dependency in your Cargo.toml file. You can do this by adding the following lines:

[dependencies.scsys]
default-features = true
features = []
version = "0.2.x"

Examples

Example 1: Using the Getter derive macro

The Getter derive macro can be used to automatically generate functional accessors for named fields within a given structure. For example, given the following structure:

#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, scsys::Getter)]
pub struct Node<T> {
    pub weight: T,
}

we can automatically generate a getter method for the weight field:

let node = Node { weight: 42 };
assert_eq!(node.weight(), 42);

Example 2: Using the VariantConstructors derive macro

The VariantConstructors derive macro can be used to automatically generate constructors for the variants of an enum. For example, given the following enum:

#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, scsys::VariantConstructors)]
pub enum Sample {
    A,
    B(usize),
    C { x: usize, y: usize },
}

we can automatically generate a functional constructor for each variant:

let a = Sample::a();
let b = Sample::b(42);
let c = Sample::c(1, 2);
assert_eq!(a, Sample::A);
assert_eq!(b, Sample::B(42));
assert_eq!(c, Sample::C { x: 1, y: 2 });

Getting Started

Prerequisites

Rust

If you don't have rustup installed, you can install it by following the instructions on the official website.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup

Once installed, you can use rustup to manage your Rust toolchain. This includes installing the latest stable version of Rust, as well as any other versions you may need for your projects. For now, we simply recommend using the latest stable version of Rust and making sure that any other toolchains you may have installed are up to date.

rustup update

Building from the source

Start by cloning the repository locally to your machine:

git clone https://github.com/scattered-systems/scsys.git --branch main

Then, navigate to the cloned directory:

cd scsys

cargo: use the built-in tool to manage the project

Build the project using the cargo build command:

cargo build --all-features --locked --release --workspace

Test the project using the cargo test command:

cargo test --all-features --locked --release --workspace

Or, benchmark the project using the cargo bench command:

cargo bench --all-features --verbose --workspace 

License

Licensed under the Apache License, Version 2.0, (LICENSE-APACHE)

Contribution

Contributions are welcome, however, ensure that you have read the CONTRIBUTING.md file before submitting a pull request.

Dependencies

~4–8.5MB
~150K SLoC