pub struct TapHttpServer { /* private fields */ }
Expand description
TAP HTTP server for handling DIDComm messages.
This server implementation provides endpoints for:
/didcomm
- For processing DIDComm messages via the TAP protocol/health
- For checking the server’s operational status
The server requires a configuration and a TapNode instance to function. The TapNode is responsible for the actual message processing logic.
Implementations§
Source§impl TapHttpServer
impl TapHttpServer
Sourcepub fn new(config: TapHttpConfig, node: TapNode) -> Self
pub fn new(config: TapHttpConfig, node: TapNode) -> Self
Creates a new HTTP server with the given configuration and TAP Node.
§Parameters
config
- The server configuration including host, port, and endpoint settingsnode
- The TAP Node instance used for processing DIDComm messages
§Returns
A new TapHttpServer instance that can be started with the start
method
Sourcepub async fn start(&mut self) -> Result<()>
pub async fn start(&mut self) -> Result<()>
Starts the HTTP server.
This method:
- Configures the server routes based on the provided configuration
- Sets up a graceful shutdown channel
- Starts the server in a separate Tokio task
The server runs until the stop
method is called.
§Returns
Ok(())
- If the server started successfullyErr(Error)
- If there was an error starting the server
Sourcepub async fn stop(&mut self) -> Result<()>
pub async fn stop(&mut self) -> Result<()>
Stops the HTTP server.
This method sends a shutdown signal to the server, allowing it to terminate gracefully.
§Returns
Ok(())
- If the server was stopped successfullyErr(Error)
- If there was an error stopping the server
Sourcepub fn node(&self) -> &Arc<TapNode>
pub fn node(&self) -> &Arc<TapNode>
Returns a reference to the underlying TAP Node.
The TAP Node is responsible for processing DIDComm messages.
Sourcepub fn config(&self) -> &TapHttpConfig
pub fn config(&self) -> &TapHttpConfig
Returns a reference to the server configuration.
The server configuration includes settings for the host, port, and endpoint.
Auto Trait Implementations§
impl Freeze for TapHttpServer
impl !RefUnwindSafe for TapHttpServer
impl Send for TapHttpServer
impl Sync for TapHttpServer
impl Unpin for TapHttpServer
impl !UnwindSafe for TapHttpServer
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
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>
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>
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