Expose Response#into_parts and Response#from_parts (#1263)

* chore: change the default visibility from pub(crate) to pub for from_parts and into_parts pair.

* chore: add docs for the Response#into_parts and Response#from_parts
This commit is contained in:
Velichko Anton
2023-02-13 18:54:37 +00:00
committed by GitHub
parent 7c0e9c853c
commit aa69a023f7
+4 -2
View File
@@ -54,11 +54,13 @@ impl<T> Response<T> {
self.message
}
pub(crate) fn into_parts(self) -> (MetadataMap, T, Extensions) {
/// Consumes `self` returning the parts of the response.
pub fn into_parts(self) -> (MetadataMap, T, Extensions) {
(self.metadata, self.message, self.extensions)
}
pub(crate) fn from_parts(metadata: MetadataMap, message: T, extensions: Extensions) -> Self {
/// Create a new gRPC response from metadata, message and extensions.
pub fn from_parts(metadata: MetadataMap, message: T, extensions: Extensions) -> Self {
Self {
metadata,
message,