https://github.com/scattered-systems/scsys
A convenience library implementing primitives and utilities for use throughout the scsys ecosystem.
https://github.com/scattered-systems/scsys
crate rust scsys
Last synced: 4 days ago
JSON representation
A convenience library implementing primitives and utilities for use throughout the scsys ecosystem.
- Host: GitHub
- URL: https://github.com/scattered-systems/scsys
- Owner: Scattered-Systems
- License: apache-2.0
- Created: 2022-10-17T16:56:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-20T15:49:44.000Z (9 months ago)
- Last Synced: 2024-10-20T18:13:19.053Z (9 months ago)
- Topics: crate, rust, scsys
- Language: Rust
- Homepage: https://crates.io/crates/scsys
- Size: 704 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# scsys
[](https://crates.io/crates/scsys)
[](https://docs.rs/scsys)
[](https://github.com/scattered-systems/scsys/blob/main/LICENSE)***
Welcome to `scsys`, a collection of useful utilities, types, and other primitives that are used in various projects developed by [Scattered Systems](https://github.com/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:
```toml
[dependencies.scsys]
default-features = true
features = [
"derive",
]
version = "0.2.x"
```### Examples
For more detailed examples, please visit the [examples](https://github.com/scattered-systems/scsys/tree/main/examples) directory in the repository. Below are some brief examples highlighting certain features of the library.
#### Example 1: _Using the `VariantConstructors` derive macro_
The `VariantConstructors` derive macro can be used to automatically generate functional accessors for named fields within a given structure. For example, given the following structure:
```rust
#[derive(
Clone,
Copy,
Debug,
Default,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
scsys::VariantConstructors
)
pub enum Sample {
A,
B(usize),
C { x: f32, y: f32 },
}
```we can automatically generate a functional constructors for each of the `Sample` variants:
```rust
let a = Sample::a();
let b = Sample::b(42);
let c = Sample::c(1.0, 2.0);
assert_eq!(a, Sample::A);
assert_eq!(b, Sample::B(42));
assert_eq!(c, Sample::C { x: 1.0, y: 2.0 });
```## Getting Started
To get started with `scsys`, you can check out the [QUICKSTART.md](QUICKSTART.md) file, which provides a step-by-step guide on how to set up your development environment and start using the library.
## License
Licensed under the Apache License, Version 2.0, ([LICENSE-APACHE](http://www.apache.org/licenses/LICENSE-2.0))
## Contribution
Contributions are welcome, however, ensure that you have read the [CONTRIBUTING.md](CONTRIBUTING.md) file before submitting a pull request.