| Crates.io | flexicon |
| lib.rs | flexicon |
| version | 0.1.0 |
| created_at | 2025-11-09 04:27:14.215879+00 |
| updated_at | 2025-11-09 04:27:14.215879+00 |
| description | Adaptive configuration toolkit: let your data structures adapt to the user, not the other way around. |
| homepage | |
| repository | https://github.com/ArcellaTeam/flexicon |
| max_upload_size | |
| id | 1923606 |
| size | 37,035 |
Configuration should adapt to the user β not the other way around.
flexicon is a minimal, embeddable toolkit for building adaptive data structures that seamlessly bridge human-authored simplicity and machine-ready expressiveness.
Write your config as a list of names.
Refine it later into a full spec.
Your tools understand both β without compromise.
At the heart of flexicon lies a simple idea:
Users deserve the easiest possible interface.
Systems deserve the richest possible specification.
Thereβs no need to choose.
We enable types that support dual representations:
["logger", "http"]){ "logger": { "level": "debug" }, "http": { "port": 8080 } })This is formalized via the AdaptiveFormat trait:
pub trait AdaptiveFormat: Serialize + Deserialize<'static> {
type SimpleFormat;
type DetailedFormat;
fn to_simple(&self) -> Self::SimpleFormat;
fn from_simple(simple: Self::SimpleFormat) -> Self;
fn to_detailed(&self) -> Self::DetailedFormat;
}
Types implementing this trait can fluidly move between user-friendly and system-optimized forms β automatically.
adaptive::NamedMap<T>A zero-overhead wrapper around HashMap<String, T> that accepts both formats out of the box:
T::from_name()use flexicon::adaptive::NamedMap;
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize)]
struct Interface {
version: String,
optional: bool,
}
impl flexicon::FromName for Interface {
fn from_name(name: &str) -> Self {
Self {
version: "latest".into(),
optional: false,
}
}
}
// Human-friendly config
let simple: NamedMap<Interface> = serde_json::from_str(r#"["wasi:cli/stdio", "my:logger"]"#)?;
// Machine-optimized spec
let detailed: NamedMap<Interface> = serde_json::from_str(r#"
{
"wasi:cli/stdio": { "version": "0.2", "optional": false },
"my:logger": { "version": "1.0", "optional": true }
}
"#)?;
NamedMap<T> is the first building block in the flexicon ecosystem β designed to be embeddable, serde-optional, and dependency-free beyond core traits.
| Module | Purpose |
|---|---|
adaptive |
Core adaptive containers (NamedMap<T>, future VersionedSet, etc.) |
humanize |
Traits for human-readable rendering (HumanReadable, MachineOptimized) |
format |
Serialization helpers for dual-format input/output (DualFormat<T>, adaptive serializers) |
Note: As of v0.1, only
adaptive::NamedMap<T>is implemented. The rest define the architecture for future expansion.
flexicon?Perfect for:
Dual-licensed under:
flexicon β because great systems speak human.