Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Request#into_parts and Request#from_parts #1118

Merged
merged 2 commits into from Oct 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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