Skip to content

literalize/rust

Repository files navigation

Literalize

A library to build literal-based singleton types and values.

Installation

To install this package, run the following command:

cargo add literalize

Usage

Apply the literal attribute to a struct with a string, integer, float, or boolean literal.

use literalize::literal;

#[literal("not_found")]
struct NotFound;

#[literal(404)]
struct HttpNotFound;

#[literal(3.14)]
struct Pi;

#[literal(true)]
struct LiteralTrue;

Features

  • serde - Implement Deserialize and Serialize from serde.
  • utoipa - Implement ToSchema from utoipa.
  • all - Enable all features.

Contributing

For contributing, please refer to the contributing guide.

License

This project is licensed under the terms of the MIT license.

About

A library to build literal-based singleton types and values

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Contributors

Languages