pub struct ProfileServiceClient<T> { /* private fields */ }Expand description
Client for this service.
Generic over T: ClientTransport. For gRPC (HTTP/2), use
Http2Connection — it has honest poll_ready and composes with
tower::balance for multi-connection load balancing. For Connect
over HTTP/1.1 (or unknown protocol), use HttpClient.
§Working with the response
Unary calls return UnaryResponse<OwnedView<FooView>>.
view() borrows the response
message, so field access is zero-copy:
let resp = client.get_profile(request).await?;
let name: &str = resp.view().name; // borrow into the response bufferIf you need the owned struct (e.g. to store or pass by value), use
into_owned():
let owned = client.get_profile(request).await?.into_owned();into_view() keeps the
zero-copy decoded body (an OwnedView) without copying; field access on it
goes through .reborrow(). Streaming responses yield one
StreamMessage per received message from
.message().await — read fields zero-copy through the generated accessor
methods (msg.name()) or .view(), or convert with .to_owned_message().
Implementations§
Source§impl<T> ProfileServiceClient<T>
impl<T> ProfileServiceClient<T>
Sourcepub fn new(transport: T, config: ClientConfig) -> Self
pub fn new(transport: T, config: ClientConfig) -> Self
Create a new client with the given transport and configuration.
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Get the client configuration.
Sourcepub fn config_mut(&mut self) -> &mut ClientConfig
pub fn config_mut(&mut self) -> &mut ClientConfig
Get a mutable reference to the client configuration.
Sourcepub async fn get_profile(
&self,
request: GetProfileRequest,
) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
pub async fn get_profile( &self, request: GetProfileRequest, ) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
Call the GetProfile RPC. Sends a request to /auth.v1.ProfileService/GetProfile.
Sourcepub async fn get_profile_with_options(
&self,
request: GetProfileRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
pub async fn get_profile_with_options( &self, request: GetProfileRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
Call the GetProfile RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn update_profile(
&self,
request: UserProfilePatch,
) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
pub async fn update_profile( &self, request: UserProfilePatch, ) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
Call the UpdateProfile RPC. Sends a request to /auth.v1.ProfileService/UpdateProfile.
Sourcepub async fn update_profile_with_options(
&self,
request: UserProfilePatch,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
pub async fn update_profile_with_options( &self, request: UserProfilePatch, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<UserProfileView<'static>>>, ConnectError>
Call the UpdateProfile RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_username_history(
&self,
request: GetUsernameHistoryRequest,
) -> Result<UnaryResponse<OwnedView<GetUsernameHistoryResponseView<'static>>>, ConnectError>
pub async fn get_username_history( &self, request: GetUsernameHistoryRequest, ) -> Result<UnaryResponse<OwnedView<GetUsernameHistoryResponseView<'static>>>, ConnectError>
Call the GetUsernameHistory RPC. Sends a request to /auth.v1.ProfileService/GetUsernameHistory.
Sourcepub async fn get_username_history_with_options(
&self,
request: GetUsernameHistoryRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<GetUsernameHistoryResponseView<'static>>>, ConnectError>
pub async fn get_username_history_with_options( &self, request: GetUsernameHistoryRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<GetUsernameHistoryResponseView<'static>>>, ConnectError>
Call the GetUsernameHistory RPC with explicit per-call options. Options override ClientConfig defaults.
Trait Implementations§
Source§impl<T: Clone> Clone for ProfileServiceClient<T>
impl<T: Clone> Clone for ProfileServiceClient<T>
Source§fn clone(&self) -> ProfileServiceClient<T>
fn clone(&self) -> ProfileServiceClient<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more