pub struct ArpyRequest<T>(pub T);Expand description
An extractor for RPC requests.
When you need more control over the handler than RpcApp::http_rpc_route
gives, you can implement your own RPC handler. Use this to extract an RPC
request in your handler implementation. See actix_web::Handler and
actix_web::FromRequest for more details.
§Example
#[derive(MsgId, Serialize, Deserialize, Debug)]
struct MyAdd(u32, u32);
impl FnRemote for MyAdd {
type Output = u32;
}
async fn my_handler(ArpyRequest(args): ArpyRequest<MyAdd>) -> impl Responder {
ArpyResponse(args.0 + args.1)
}
App::new().route("api/my-add", web::post().to(my_handler));Tuple Fields§
§0: TTrait Implementations§
Source§impl<Args: FnRemote> FromRequest for ArpyRequest<Args>
impl<Args: FnRemote> FromRequest for ArpyRequest<Args>
Source§type Future = Pin<Box<dyn Future<Output = Result<ArpyRequest<Args>, <ArpyRequest<Args> as FromRequest>::Error>>>>
type Future = Pin<Box<dyn Future<Output = Result<ArpyRequest<Args>, <ArpyRequest<Args> as FromRequest>::Error>>>>
Future that resolves to a
Self. Read moreSource§fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
Create a
Self from request parts asynchronously.Auto Trait Implementations§
impl<T> Freeze for ArpyRequest<T>where
T: Freeze,
impl<T> RefUnwindSafe for ArpyRequest<T>where
T: RefUnwindSafe,
impl<T> Send for ArpyRequest<T>where
T: Send,
impl<T> Sync for ArpyRequest<T>where
T: Sync,
impl<T> Unpin for ArpyRequest<T>where
T: Unpin,
impl<T> UnsafeUnpin for ArpyRequest<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ArpyRequest<T>where
T: UnwindSafe,
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