Skip to main content

tonic/metadata/
mod.rs

1/*
2 *
3 * Copyright 2025 gRPC authors.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25//! Contains data structures and utilities for handling gRPC custom metadata.
26
27mod encoding;
28mod key;
29mod map;
30mod value;
31
32pub use self::encoding::Ascii;
33pub use self::encoding::Binary;
34pub use self::key::AsciiMetadataKey;
35pub use self::key::BinaryMetadataKey;
36pub use self::key::MetadataKey;
37pub use self::map::Entry;
38pub use self::map::GetAll;
39pub use self::map::Iter;
40pub use self::map::IterMut;
41pub use self::map::KeyAndMutValueRef;
42pub use self::map::KeyAndValueRef;
43pub use self::map::KeyRef;
44pub use self::map::Keys;
45pub use self::map::MetadataMap;
46pub use self::map::OccupiedEntry;
47pub use self::map::VacantEntry;
48pub use self::map::ValueDrain;
49pub use self::map::ValueIter;
50pub use self::map::ValueRef;
51pub use self::map::ValueRefMut;
52pub use self::map::Values;
53pub use self::map::ValuesMut;
54pub use self::value::AsciiMetadataValue;
55pub use self::value::BinaryMetadataValue;
56pub use self::value::MetadataValue;
57use http::HeaderValue;
58
59pub(crate) use self::map::GRPC_TIMEOUT_HEADER;
60
61/// HTTP Header `content-type` value for gRPC calls.
62pub const GRPC_CONTENT_TYPE: HeaderValue = HeaderValue::from_static("application/grpc");
63
64/// The metadata::errors module contains types for errors that can occur
65/// while handling gRPC custom metadata.
66pub mod errors {
67    pub use super::encoding::InvalidMetadataValue;
68    pub use super::encoding::InvalidMetadataValueBytes;
69    pub use super::key::InvalidMetadataKey;
70    pub use super::value::ToStrError;
71}