config-types

Crates.ioconfig-types
lib.rsconfig-types
version1.1.0
created_at2025-03-07 00:11:56.847975+00
updated_at2025-03-10 12:59:44.770773+00
descriptionA library which provides ergononic types for configuration files
homepage
repositoryhttps://github.com/victornguen/config-types-rs
max_upload_size
id1582055
size25,169
Victor Nguen (victornguen)

documentation

README

Config types for rust

This is a collection of config types for Rust. It is intended to be used with

  • config
  • figment
  • or any other configuration library that supports serde.

Usage

See example for usage.

DurationConf

DurationConf is a wrapper around std::time::Duration that allows you to specify duration in human readable format in your config.

For example, you can specify duration in your config file like this:

duration = "5m"

Supported suffixes(case insensitive):

  • ns - nanoseconds
  • us - microseconds
  • ms - milliseconds
  • s - seconds
  • m - minutes
  • h - hours

ByteSizeConf

ByteSizeConf allows you to specify byte size in your config.

For example, if you want to specify max file size in your config file, you can do it like this:

max_file_size = "10Mi"

Supported suffixes(case insensitive):

  • B - bytes
  • Ki - kibibytes
  • Kb - kilobytes
  • Mi - mebibytes
  • Mb - megabytes
  • Gi - gibibytes
  • Gb - gigabytes
  • Ti - tebibytes
  • Tb - terabytes
Commit count: 6

cargo fmt