Crate maybe

Source
Expand description

A simple enum similar to Option<T> but with three variants:

  • Some(T): Contains a value of type T
  • None: Explicitly set to null/none
  • Void: Not set/undefined (default state)

This is particularly useful when working with APIs or data formats that need to distinguish between undefined fields and fields explicitly set to null, such as GraphQL, JSON, or other protocols where this distinction matters.

§Features

This crate has optional support for serde and async-graphql through features:

[dependencies]
maybe = {
  version = "0.1",
  features = [
    "serde",         # Enables serialization/deserialization support via serde
    "async_graphql"  # Enables integration with async-graphql for use in GraphQL schemas
  ]
}

Enums§

Maybe
Maybe<T> represents a value that can be in one of three states: