Skip to content

Commit

Permalink
feat: Expose Request#into_parts and Request#from_parts (#1118)
Browse files Browse the repository at this point in the history
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
  • Loading branch information
slinkydeveloper committed Oct 19, 2022
1 parent 64e29c6 commit b409ddd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tonic/src/request.rs
Expand Up @@ -140,11 +140,13 @@ impl<T> Request<T> {
self.message
}

pub(crate) fn into_parts(self) -> (MetadataMap, Extensions, T) {
/// Consumes `self` returning the parts of the request.
pub fn into_parts(self) -> (MetadataMap, Extensions, T) {
(self.metadata, self.extensions, self.message)
}

pub(crate) fn from_parts(metadata: MetadataMap, extensions: Extensions, message: T) -> Self {
/// Create a new gRPC request from metadata, extensions and message.
pub fn from_parts(metadata: MetadataMap, extensions: Extensions, message: T) -> Self {
Self {
metadata,
extensions,
Expand Down

0 comments on commit b409ddd

Please sign in to comment.