pub struct HttpServer<P, A, Auth = NoopAuthenticator>where
P: A2aService + Send + Sync + 'static,
A: AgentInfoProvider + Send + Sync + 'static,
Auth: Authenticator + Send + Sync + 'static,{ /* private fields */ }Expand description
HTTP server for the A2A protocol
Implementations§
Source§impl<P, A> HttpServer<P, A>
impl<P, A> HttpServer<P, A>
Source§impl<P, A, Auth> HttpServer<P, A, Auth>where
P: A2aService + Send + Sync + 'static,
A: AgentInfoProvider + Send + Sync + 'static,
Auth: Authenticator + Clone + Send + Sync + 'static,
impl<P, A, Auth> HttpServer<P, A, Auth>where
P: A2aService + Send + Sync + 'static,
A: AgentInfoProvider + Send + Sync + 'static,
Auth: Authenticator + Clone + Send + Sync + 'static,
Sourcepub fn with_auth(
processor: P,
agent_info: A,
address: String,
authenticator: Auth,
) -> Self
pub fn with_auth( processor: P, agent_info: A, address: String, authenticator: Auth, ) -> Self
Create a new HTTP server with authentication
Sourcepub async fn start(&self) -> Result<(), A2AError>
pub async fn start(&self) -> Result<(), A2AError>
Start the HTTP server on the configured address.
Sourcepub async fn serve_on(&self, listener: TcpListener) -> Result<(), A2AError>
pub async fn serve_on(&self, listener: TcpListener) -> Result<(), A2AError>
Serve on a listener the caller has already bound.
start binds the address itself, which leaves a caller
that asked for port 0 no way to learn which port it got, and any caller
no way to know the socket is accepting yet. Binding first answers both:
listener.local_addr() reports the real address, and the kernel queues
connections from the moment of the bind, so a client may connect before
this future is ever polled. That is what a test needs to skip the
“sleep and hope” step, and what lets a supervisor hand out port 0 and
report back the port the agent actually listens on.
Auto Trait Implementations§
impl<P, A, Auth> Freeze for HttpServer<P, A, Auth>
impl<P, A, Auth> RefUnwindSafe for HttpServer<P, A, Auth>
impl<P, A, Auth> Send for HttpServer<P, A, Auth>
impl<P, A, Auth> Sync for HttpServer<P, A, Auth>
impl<P, A, Auth> Unpin for HttpServer<P, A, Auth>
impl<P, A, Auth> UnsafeUnpin for HttpServer<P, A, Auth>
impl<P, A, Auth> UnwindSafe for HttpServer<P, A, Auth>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more