Skip to main content

smol_bytes/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![deny(missing_docs)]
4#![warn(unsafe_op_in_unsafe_fn)]
5#![doc = include_str!("../README.md")]
6
7#[cfg(all(not(feature = "std"), feature = "alloc"))]
8extern crate alloc as std;
9
10#[cfg(feature = "std")]
11extern crate std;
12
13#[cfg(any(feature = "std", feature = "alloc"))]
14pub use ::bytes::{Buf, BufMut};
15
16#[cfg(any(feature = "std", feature = "alloc"))]
17#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
18pub use ::bytes::buf;
19
20#[cfg(any(feature = "std", feature = "alloc"))]
21#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
22pub use bytes::strategy::{
23  compact,
24  shared::{self, Bytes},
25};
26
27#[cfg(any(feature = "std", feature = "alloc"))]
28#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
29pub(crate) use bytes::strategy;
30
31#[cfg(any(feature = "std", feature = "alloc"))]
32#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
33pub use bytes_mut::BytesMut;
34
35#[cfg(any(feature = "std", feature = "alloc"))]
36#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
37pub use bytes::strategy::shared::Utf8Bytes;
38
39#[cfg(any(feature = "std", feature = "alloc"))]
40#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
41pub use utf8_bytes_mut::Utf8BytesMut;
42
43#[cfg(any(feature = "std", feature = "alloc"))]
44#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
45pub use str_ext::{StrExt, ToUtf8Bytes};
46
47pub use buffer::{Buffer, INLINE_CAP};
48pub use error::*;
49pub use utf8_buf::{Utf8Buf, Utf8BufMut};
50pub use utf8_buffer::Utf8Buffer;
51
52#[cfg(any(feature = "std", feature = "alloc"))]
53mod bytes;
54#[cfg(any(feature = "std", feature = "alloc"))]
55mod bytes_mut;
56
57#[cfg(feature = "async-graphql")]
58#[cfg_attr(docsrs, doc(cfg(feature = "async-graphql")))]
59mod graphql;
60
61#[cfg(feature = "schemars")]
62#[cfg_attr(docsrs, doc(cfg(feature = "schemars")))]
63mod json_schema;
64
65#[cfg(feature = "pyo3")]
66#[cfg_attr(docsrs, doc(cfg(feature = "pyo3")))]
67mod python;
68
69#[cfg(feature = "sqlx")]
70#[cfg_attr(docsrs, doc(cfg(feature = "sqlx")))]
71mod sql;
72
73#[cfg(feature = "wasm")]
74mod wasm;
75#[cfg(feature = "wasm")]
76mod wasm_iter;
77
78#[cfg(feature = "pyo3")]
79#[cfg_attr(docsrs, doc(cfg(feature = "pyo3")))]
80pub use python::{register_classes, register_compact, register_shared};
81
82mod buffer;
83
84mod utf8_buf;
85mod utf8_buffer;
86
87#[cfg(any(feature = "std", feature = "alloc"))]
88mod utf8_bytes;
89#[cfg(any(feature = "std", feature = "alloc"))]
90mod utf8_bytes_mut;
91
92#[cfg(any(feature = "std", feature = "alloc"))]
93mod str_ext;
94
95#[cfg(any(feature = "std", feature = "alloc"))]
96mod macros;
97
98/// Error types for byte buffer operations.
99pub mod error;