Registry / async / actix-service

actix-service

JSON →
library2.0.3rscratesunverified

Service trait and combinators for representing asynchronous request/response operations.

# Cargo.toml [dependencies] actix-service = "2.0.3"
INSTALL
IMPORT
SIG · ACTIX-SERVICE
A
actix-service
asyncrustv2.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Service
use actix_service::Service;

Define a simple service implementing the Service trait.

use actix_service::Service; use futures_util::future::ok; struct MyService; impl Service for MyService { type Request = String; type Response = String; type Error = (); type Future = futures_util::future::Ready<Result<String, ()>>; fn poll_ready(&self, _: &mut std::task::Context<'_>) -> std::task::Poll<Result<(), Self::Error>> { std::task::Poll::Ready(Ok(())) } fn call(&self, req: String) -> Self::Future { ok(req) } } fn main() { let svc = MyService; let res = svc.call("hello".into()).into_inner(); println!("{:?}", res); }
Debug
Known issues
gotchaRequires an async runtime (e.g., tokio or actix-rt) to execute futures.
fix
Add `actix-rt` as a dependency and use `#[actix_rt::main]` or similar.
affects: >=2.0.0
Upgrade
Version history
2.0.3latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
61 hits · last 30 days
node
52
Resources
actix-service — cargo add actix-service · libregistry