Provides the Named, MaybeNamed, Labeled, MaybeLabeled, Collection,
and CollectionMut traits for Rust.
- Supports opting out of any feature using comprehensive feature flags.
- Adheres to the Rust API Guidelines in its naming conventions.
- 100% free and unencumbered public domain software.
- Rust 1.70+
cargo add dogma[dependencies]
dogma = "0.1"[dependencies]
dogma = { version = "0.1", default-features = false, features = ["traits"] }use dogma::*;use dogma::traits::Named;
use std::borrow::Cow;
struct Person {
pub first_name: String,
pub last_name: String,
}
impl Named for Person {
fn name(&self) -> Cow<str> {
format!("{} {}", self.first_name, self.last_name).into()
}
}use dogma::traits::MaybeNamed;
use std::borrow::Cow;
struct UserProfile {
pub id: u64,
pub display_name: Option<String>,
}
impl MaybeNamed for UserProfile {
fn name(&self) -> Option<Cow<str>> {
self.display_name.as_ref().map(Cow::from)
}
}| Crate (Feature) | Version | Usage | Summary |
|---|---|---|---|
clap] ("clap") |
4.5 | Derives clap::builder::TypedValueParser |
|
miette ("miette") |
7.6 | Enhances dogma::{IriError, UriError} |
|
serde ("serde") |
1 | Derives serde::{Serialize, Deserialize} |
|
git clone https://github.com/dogmatists/dogma.rs.git