Benign cargo Download

scope.rs

Contains an unbounded block loopRust test marker or harness
SHA-2560f7f6301b53257f3140f060228a4b56845979c2423582f5d7b77f34104a40aa0

Evidence

imports http::Method lines 1–28
1use std::marker::PhantomData;
2use std::mem;
3use std::rc::Rc;
4
5use futures::{Async, Future, Poll};
6
7use error::Error;
8use handler::{
9 AsyncResult, AsyncResultItem, FromRequest, Handler, Responder, RouteHandler,
10 WrapHandler,
11};
12use http::Method;
13use httprequest::HttpRequest;
14use httpresponse::HttpResponse;
15use middleware::{
16 Finished as MiddlewareFinished, Middleware, Response as MiddlewareResponse,
17 Started as MiddlewareStarted,
18};
19use pred::Predicate;
20use resource::{DefaultResource, Resource};
21use router::{ResourceDef, Router};
22use server::Request;
23use with::WithFactory;
24
25/// Resources scope
26///
27/// Scope is a set of resources with common root path.
28/// Scopes collec …
English function-word token "and" lines 30–33
30:51… i.e `/app` would
31/// be converted to a `/app/` and it would not match `/app` path.
32///
33/// You can get variable path segments from `HttpRequest: …
Contains an unbounded block loop lines 460–465
460:23… ;
461
462 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
463 loop {
464 if let ComposeState::Completed(ref mut resp) = self.state {
465 let resp = resp.resp.take().unwrap(); …
imports http::StatusCode lines 737–759
⋯4 lines
741}
742
743#[cfg(test)]
744mod tests {
745 use bytes::Bytes;
746
747 use application::App;
748 use body::Body;
749 use http::{Method, StatusCode};
750 use httprequest::HttpRequest;
751 use httpresponse::HttpResponse;
752 use pred;
753 use test::TestRequest;
754
755 #[test]
756 fn test_scope() {
757 let app = App::new()
758 .scope("/app", |scope| {
759 scope.resource("/pa …
Absolute container application root path lines 760–769
760:6… }).finish();
761
762 let req = TestRequest::with_uri("/app/path1").request();
763 let resp = app.run(req);
764 assert_eq!(resp.as_msg().status(), StatusCode::OK);
⋯5 lines

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.