#enums #sum #three #left #middle #variant

no-std among

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

3 releases

new 0.1.3 Oct 4, 2024
0.1.2 Sep 14, 2024
0.1.1 Sep 2, 2024
0.1.0 Sep 2, 2024

#437 in Data structures

Download history 290/week @ 2024-08-29 182/week @ 2024-09-05 1167/week @ 2024-09-12 1154/week @ 2024-09-19 677/week @ 2024-09-26

3,200 downloads per month
Used in 4 crates (3 directly)

MIT/Apache

92KB
1.5K 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–6MB
~24K SLoC