Merge pull request #863 from hyperium/guide-server
docs(guide): build and test markdown files in doc directory
This commit is contained in:
		| @@ -22,7 +22,7 @@ script: | ||||
|   - ./.travis/readme.py | ||||
|   - cargo build --verbose $FEATURES | ||||
|   - cargo test --verbose $FEATURES | ||||
|   - 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo bench --no-run; fi' | ||||
|   - 'for f in ./doc/**/*.md; do rustdoc --test $f; done' | ||||
|  | ||||
| addons: | ||||
|   apt: | ||||
| @@ -40,7 +40,6 @@ after_success: | | ||||
|     ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/hyper-* && | ||||
|     [ $TRAVIS_PULL_REQUEST = false ] && | ||||
|     { [ "$TRAVIS_TAG" != "" ] || [ "$TRAVIS_BRANCH" == "master" ]; } && | ||||
|     cargo doc --no-deps && | ||||
|     ./.travis/docs.sh && | ||||
|     echo "\nDocs published.\n" | ||||
|  | ||||
|   | ||||
| @@ -2,6 +2,16 @@ | ||||
|  | ||||
| set -o errexit | ||||
|  | ||||
| shopt -s globstar | ||||
|  | ||||
| cargo doc --no-deps | ||||
|  | ||||
| for f in ./doc/**/*.md; do | ||||
|     rustdoc $f -L ./target/debug -L ./target/debug/deps -o "$(dirname $f)"; | ||||
| done | ||||
|  | ||||
| cp --parent ./doc/**/*.md ./target | ||||
|  | ||||
| git clone --branch gh-pages "https://$TOKEN@github.com/${TRAVIS_REPO_SLUG}.git" deploy_docs | ||||
| cd deploy_docs | ||||
|  | ||||
|   | ||||
							
								
								
									
										30
									
								
								doc/guide/server.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								doc/guide/server.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| % Server Guide | ||||
|  | ||||
| ## The `Handler` | ||||
|  | ||||
| ```ignore,no_run | ||||
| extern crate hyper; | ||||
| use hyper::server::{Handler, Request, Response, Decoder, Encoder, Next, HttpStream as Http}; | ||||
|  | ||||
| struct Hello; | ||||
|  | ||||
| impl Handler<Http> for Hello { | ||||
|     fn on_request(&mut self, req: Request<Http>) -> Next { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     fn on_request_readable(&mut self, decoder: &mut Decoder<Http>) -> Next { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     fn on_response(&mut self, res: &mut Response) -> Next { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     fn on_response_writable(&mut self, encoder: &mut Encoder<Http>) -> Next { | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
| # fn main() {} | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user