Socket
Book a DemoInstallSign in
Socket

a0

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a0

0.0.4
Cargo
Version published
Maintainers
1
Created
Source

A Rust procedural macro for automatically generating structs from configuration files (JSON, YAML, TOML).

Example Usage

  • Create a configuration file (e.g., config.yaml).
  • Use the generate attribute macro:
server:
  port: 8080
features:
  - logging
  - authentication

Generate and use the struct:

#[generate("config.yaml")]
struct AppConfig;

fn main() {
    let config = AppConfig::new();
    println!("Server port: {}", config.server.port);
    println!("Features: {:?}", config.features);
}

API

  • new(): Creates a new instance with values from the file.
  • default(): Creates a new instance no values from the file.
  • is_empty(): Returns true if all fields are default values.

FAQs

Package last updated on 29 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.