Skip to main content

sval_buffer/
lib.rs

1/*!
2Buffering support for `sval`.
3
4This crate provides the [`ValueBuf`] type, which can buffer a flat
5stream of data into a tree of borrowed values.
6
7Some functionality requires the `alloc` Cargo feature to be enabled.
8Rather than conditionally compile these methods, this library stubs
9out functionality when an allocator isn't available.
10*/
11
12#![doc(html_logo_url = "https://raw.githubusercontent.com/sval-rs/sval/main/asset/logo.svg")]
13#![no_std]
14#![deny(missing_docs)]
15
16mod error;
17
18#[cfg(feature = "std")]
19#[macro_use]
20#[allow(unused_imports)]
21extern crate std as libstd;
22
23#[cfg(not(feature = "alloc"))]
24extern crate core as std;
25
26#[cfg(any(test, feature = "alloc"))]
27#[macro_use]
28#[allow(unused_imports)]
29extern crate alloc;
30#[cfg(feature = "alloc")]
31extern crate core;
32
33#[cfg(feature = "alloc")]
34mod std {
35    #[allow(unused_imports)]
36    pub use crate::{
37        alloc::{borrow, boxed, collections, string, vec},
38        core::{convert, fmt, hash, marker, mem, ops, result, str},
39    };
40
41    #[cfg(feature = "std")]
42    pub use libstd::error;
43}
44
45mod fragments;
46mod value;
47
48#[cfg(feature = "alloc")]
49fn assert_static<T: 'static>(_: &mut T) {}
50
51pub use self::{error::*, fragments::*, value::*};