Skip to main content

known_types/
lib.rs

1// This is free and unencumbered software released into the public domain.
2
3//! C type aliases and shared social-handle validation.
4//!
5//! - [`c`] provides C-compatible primitive aliases and borrowed C strings.
6//! - [`handle`] documents the common handle contract and provides validation
7//!   helpers and errors.
8//!
9//! Platform types live in their own crates, such as
10//! [`known-types-x`](https://docs.rs/known-types-x) and
11//! [`known-types-linkedin`](https://docs.rs/known-types-linkedin); they are not
12//! re-exported here. Both modules in this crate work without default features
13//! or heap allocation.
14//!
15//! ```
16//! use known_types::c;
17//!
18//! let name = c::Str::from_bytes_with_nul(b"known\0")?;
19//! assert_eq!(name.to_bytes(), b"known");
20//! assert!(c::Str::from_bytes_with_nul(b"missing terminator").is_err());
21//! # Ok::<(), c::FromBytesWithNulError>(())
22//! ```
23
24#![no_std]
25#![deny(unsafe_code)]
26#![deny(missing_debug_implementations)]
27#![deny(clippy::unwrap_used)]
28#![deny(clippy::alloc_instead_of_core)]
29
30//#[cfg(doctest)]
31//#[doc = include_str!("../README.md")]
32//pub struct ReadmeDoctests;
33
34#[cfg(feature = "alloc")]
35extern crate alloc;
36
37pub mod c;
38pub mod handle;