Known Types
Well-known types for Rust. Validated social handles, API schemas, package metadata, and C type aliases, organized into platform-specific crates.
[Features] | [Prerequisites] | [Installation] | [Examples] | [Reference] | [Development]
✨ Features
- Zero default dependencies, only optional integrations.
- Supports opting out of any feature using comprehensive feature flags.
- Adheres to the Rust API Guidelines in its naming conventions.
- Cuts red tape: 100% free and unencumbered public domain software.
🛠️ Prerequisites
- Rust 1.94+ (2024 edition)
⬇️ Installation
Installation via Cargo
Installation via Cargo (all crates)
Installation in Cargo.toml
Enable all default features:
[]
= "0"
Installation in Cargo.toml (with all features enabled, in all crates)
[]
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
= "0"
Enable only specific features:
[]
= { = "0.1", = false, = ["alloc", "serde"] }
Installation in Cargo.toml (with only specific features enabled, in all crates)
[]
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
= { = "0", = false, = ["serde"] }
👉 Examples
Importing the Library
use known_types;
Importing the Library (all crates)
use known_types;
use known_types_anthropic;
use known_types_github;
use known_types_google;
use known_types_graphql;
use known_types_gravatar;
use known_types_ietf;
use known_types_instagram;
use known_types_linkedin;
use known_types_luma;
use known_types_nostr;
use known_types_openai;
use known_types_pypi;
use known_types_rubygems;
use known_types_w3c;
use known_types_x;
Validating Social Media Handles
Construct handles with FromStr or TryFrom<&str> / TryFrom<String>:
use ;
📚 Reference
Crates
| Crate | Version | Docs | Summary |
|---|---|---|---|
| known-types | Well-known types. | ||
| known-types-anthropic | Well-known types for Anthropic APIs. | ||
| known-types-github | Well-known types for GitHub APIs. | ||
| known-types-google | Well-known types for Google APIs. | ||
| known-types-graphql | Well-known types for GraphQL specifications. | ||
| known-types-gravatar | Well-known types for Gravatar APIs. | ||
| known-types-ietf | Well-known types for IETF specifications. | ||
| known-types-instagram | Well-known types for Instagram APIs. | ||
| known-types-linkedin | Well-known types for LinkedIn APIs. | ||
| known-types-luma | Well-known types for Luma APIs. | ||
| known-types-nostr | Well-known types for the Nostr protocol. | ||
| known-types-openai | Well-known types for OpenAI APIs. | ||
| known-types-pypi | Well-known types for Python Package Index (PyPI) APIs. | ||
| known-types-rubygems | Well-known types for RubyGems.org APIs. | ||
| known-types-w3c | Well-known types for W3C specifications. | ||
| known-types-x | Well-known types for X (formerly Twitter) APIs. | ||
Integrations
| Crate (Feature) | Version | Usage | Summary |
|---|---|---|---|
async-graphql ("async-graphql") |
7.2 | Implements ScalarType, InputType, OutputType, and connection::CursorType for handles |
|
borsh ("borsh") |
1.5 | Derives borsh::{BorshSerialize, BorshDeserialize} |
|
musli ("musli") |
0.0.131 | Derives musli::{Encode, Decode} |
|
serde ("serde") |
1 | Derives serde::{Serialize, Deserialize} |
|
SQLx ("sqlx") |
0.9 | Implements sqlx::{Type, Encode, Decode} for handles |
|
See Also
| Package | Crate | Docs |
|---|---|---|
| known-errors | ||
| known-languages | ||
| known-paths | ||
| known-schemes | ||
| known-types |
👨💻 Development