pdk_classy/grpc/
response.rs

1// Copyright (c) 2025, Salesforce, Inc.,
2// All rights reserved.
3// For full license text, see the LICENSE.txt file
4
5/// A gRPC response containing an inner typed message.
6pub struct GrpcResponse<T> {
7    inner: T,
8}
9
10impl<T> GrpcResponse<T> {
11    pub(super) fn new(inner: T) -> Self {
12        Self { inner }
13    }
14
15    /// Returns a reference to the inner message.
16    pub fn get_ref(&self) -> &T {
17        &self.inner
18    }
19
20    /// Returns a mutable reference to the inner message.
21    pub fn get_mut(&mut self) -> &mut T {
22        &mut self.inner
23    }
24
25    /// Consumes this response and returns the inner message.
26    pub fn into_inner(self) -> T {
27        self.inner
28    }
29}