#enums #three #variant #sum #left #right

no-std among

The enum Among with variants Left, Middle and Right is a general purpose sum type with three cases

7 releases

0.1.7 Oct 14, 2024
0.1.6 Oct 8, 2024
0.1.2 Sep 14, 2024

#485 in Data structures

Download history 595/week @ 2024-09-24 1804/week @ 2024-10-01 1977/week @ 2024-10-08 1349/week @ 2024-10-15 1061/week @ 2024-10-22 1241/week @ 2024-10-29 962/week @ 2024-11-05 848/week @ 2024-11-12 221/week @ 2024-11-19 159/week @ 2024-11-26 108/week @ 2024-12-03 86/week @ 2024-12-10 408/week @ 2024-12-17 547/week @ 2024-12-24 112/week @ 2024-12-31 112/week @ 2025-01-07

1,186 downloads per month
Used in 6 crates (4 directly)

MIT/Apache

100KB
2K SLoC

Among

The enum Among with variants Left, Middle and Right is a general purpose sum type with three cases.

github LoC Build

docs.rs crates.io crates.io license

English | 简体中文

Introduction

The enum Among with variants Left, Middle and Right and trait implementations.

Installation

  • Use with default feature

    [dependencies]
    among = "0.1"
    
  • Use without std and alloc

    [dependencies]
    among = { version = "0.1", default-features = false }
    
  • Enable futures feature to enable trait implementation including futures::io::AsyncRead, futures::io::AsyncBufRead, futures::io::AsyncWrite, and futures::io::AsyncSeek.

    [dependencies]
    among = { version = "0.1", features = ["futures", "std"] }
    
  • Enable tokio feature to enable trait implementation including tokio::io::AsyncRead, tokio::io::AsyncBufRead, tokio::io::AsyncWrite and tokio::io::AsyncSeek.

    [dependencies]
    among = { version = "0.1", features = ["tokio", "std"] }
    

Pedigree

This code is inspired and modified based on rayon-rs/either.

License

among is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2024 Al Liu.

Dependencies

~0–5.5MB
~24K SLoC