pub struct AgentClient { /* private fields */ }Expand description
Agent client for communicating with external agents
Implementations§
Source§impl AgentClient
impl AgentClient
Sourcepub async fn unix_socket(
id: impl Into<String>,
path: impl AsRef<Path>,
timeout: Duration,
) -> Result<Self, AgentProtocolError>
pub async fn unix_socket( id: impl Into<String>, path: impl AsRef<Path>, timeout: Duration, ) -> Result<Self, AgentProtocolError>
Create a new Unix socket agent client
Sourcepub async fn grpc(
id: impl Into<String>,
address: impl Into<String>,
timeout: Duration,
) -> Result<Self, AgentProtocolError>
pub async fn grpc( id: impl Into<String>, address: impl Into<String>, timeout: Duration, ) -> Result<Self, AgentProtocolError>
Create a new gRPC agent client
§Arguments
id- Agent identifieraddress- gRPC server address (e.g., “http://localhost:50051”)timeout- Timeout for agent calls
Sourcepub async fn send_event(
&mut self,
event_type: EventType,
payload: impl Serialize,
) -> Result<AgentResponse, AgentProtocolError>
pub async fn send_event( &mut self, event_type: EventType, payload: impl Serialize, ) -> Result<AgentResponse, AgentProtocolError>
Send an event to the agent and get a response
Sourcepub async fn close(self) -> Result<(), AgentProtocolError>
pub async fn close(self) -> Result<(), AgentProtocolError>
Close the agent connection
Auto Trait Implementations§
impl !Freeze for AgentClient
impl !RefUnwindSafe for AgentClient
impl Send for AgentClient
impl Sync for AgentClient
impl Unpin for AgentClient
impl !UnwindSafe for AgentClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request