tonic: Document Ascii and Binary (#993)

This fixes the problem where MetadataValue::from<i16> (and other numeric types) aren't shown in Rustdoc, because they're implemented for Metadata<Ascii>, and Ascii is hidden.

Co-authored-by: Adam Chalmers <[email protected]>
This commit is contained in:
Adam Chalmers
2022-05-03 12:09:15 -04:00
committed by GitHub
co-authored by Adam Chalmers
parent edc5a0d88d
commit 2e19b660e5
+18 -2
View File
@@ -51,11 +51,27 @@ pub trait ValueEncoding: Clone + Eq + PartialEq + Hash + self::value_encoding::S
fn is_valid_key(key: &str) -> bool;
}
/// gRPC metadata values can be either ASCII strings or binary. Note that only
/// visible ASCII characters (32-127) are permitted.
/// This type should never be instantiated -- in fact, it's impossible
/// to, because there's no variants to instantiate. Instead, it's just used as
/// a type parameter for [`MetadataKey`] and [`MetadataValue`].
///
/// [`MetadataKey`]: struct.MetadataKey.html
/// [`MetadataValue`]: struct.MetadataValue.html
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[doc(hidden)]
#[non_exhaustive]
pub enum Ascii {}
/// gRPC metadata values can be either ASCII strings or binary.
/// This type should never be instantiated -- in fact, it's impossible
/// to, because there's no variants to instantiate. Instead, it's just used as
/// a type parameter for [`MetadataKey`] and [`MetadataValue`].
///
/// [`MetadataKey`]: struct.MetadataKey.html
/// [`MetadataValue`]: struct.MetadataValue.html
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[doc(hidden)]
#[non_exhaustive]
pub enum Binary {}
// ===== impl ValueEncoding =====