Crates.io | dogma |
lib.rs | dogma |
version | |
source | src |
created_at | 2020-08-03 16:06:08.161059+00 |
updated_at | 2025-05-09 05:25:37.745793+00 |
description | Provides `Named`, `MaybeNamed`, `Labeled`, `MaybeLabeled`, `Collection`, and `CollectionMut` traits. |
homepage | https://github.com/dogmatists/dogma.rs |
repository | https://github.com/dogmatists/dogma.rs |
max_upload_size | |
id | 272567 |
Cargo.toml error: | TOML parse error at line 20, column 1 | 20 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Provides the Named
, MaybeNamed
, Labeled
, MaybeLabeled
, Collection
,
and CollectionMut
traits for Rust.
cargo add dogma
Cargo.toml
(with all features enabled)[dependencies]
dogma = "0.1"
Cargo.toml
(with only specific features enabled)[dependencies]
dogma = { version = "0.1", default-features = false, features = ["traits"] }
use dogma::*;
Named
traituse 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()
}
}
MaybeNamed
traituse 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)
}
}
git clone https://github.com/dogmatists/dogma.rs.git