1
0
mirror of https://github.com/actix/actix-website synced 2025-03-20 14:45:18 +01:00

Merge branch 'master' into master

This commit is contained in:
Nikolay Kim 2018-07-11 14:09:54 +06:00 committed by GitHub
commit 8de5de85a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 187 additions and 93 deletions

View File

@ -1,10 +1,18 @@
baseurl = "https://actix.rs"
title = "actix" title = "actix"
languageCode = "en-us"
canonifyURLs = true canonifyURLs = true
googleAnalytics = "UA-110322332-1" googleAnalytics = "UA-110322332-1"
pygmentsUseClasses = true pygmentsUseClasses = true
pygmentsCodeFences = true pygmentsCodeFences = true
defaultContentLanguageInSubdir = false
enableRobotsTXT = true
enableMissingTranslationPlaceholders = true
DefaultContentLanguage = "en"
baseURL = "https://actix.rs"
[languages.en]
languageCode = "en-US"
languageName = "English"
weight = 1
[params] [params]
actixVersion = "0.5" actixVersion = "0.5"

View File

@ -184,7 +184,7 @@ When you register a handler using `Route::with()`, it returns a configuration in
a *Json* extractor it returns a *JsonConfig*. You can configure the maximum size of the json a *Json* extractor it returns a *JsonConfig*. You can configure the maximum size of the json
payload as well as a custom error handler function. payload as well as a custom error handler function.
The following example limits the size of the payload to 4kb and uses a custom error hander. The following example limits the size of the payload to 4kb and uses a custom error handler.
```rust ```rust
#[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_derive;

View File

@ -15,7 +15,7 @@ application factory must have `Send` + `Sync` boundaries. More about that in the
To bind to a specific socket address, To bind to a specific socket address,
[`bind()`](../../actix-web/actix_web/server/struct.HttpServer.html#method.bind) [`bind()`](../../actix-web/actix_web/server/struct.HttpServer.html#method.bind)
must be used, and it may be called multiple times. To bind ssl socket must be used, and it may be called multiple times. To bind ssl socket,
[`bind_ssl()`](../../actix-web/actix_web/server/struct.HttpServer.html#method.bind_ssl) [`bind_ssl()`](../../actix-web/actix_web/server/struct.HttpServer.html#method.bind_ssl)
or [`bind_tls()`](../../actix-web/actix_web/server/struct.HttpServer.html#method.bind_tls) or [`bind_tls()`](../../actix-web/actix_web/server/struct.HttpServer.html#method.bind_tls)
should be used. To start the http server, one of the start methods. should be used. To start the http server, one of the start methods.

8
i18n/en.toml Normal file
View File

@ -0,0 +1,8 @@
[home]
other = "Home"
[docs]
other = "Documentation"
[community]
other = "Community"
[code]
other = "Code"

View File

@ -1,33 +1,34 @@
{{ partial "header" . }} {{ partial "header" . }}
<div class="jumbotron"> <div id="act-home">
<div class="actix-jumbotron"> <div class="jumbotron">
<img src="/img/logo-large.png" class="align-middle actix-logo" alt=""> <div class="actix-jumbotron">
<p class="lead">rust's powerful actor system and most fun web framework</p> <img src="/img/logo-large.png" class="align-middle actix-logo" alt="">
<p class="lead">rust's powerful actor system and most fun web framework</p>
</div>
</div> </div>
</div>
<div class="container actix-home"> <div class="container actix-home">
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="actix-features"> <div class="actix-features">
<h2> <h2>
<i class="fa fa-fw fa-shield" aria-hidden="true"></i> <i class="fa fa-fw fa-shield" aria-hidden="true"></i>
Type Safe Type Safe
</h2> </h2>
<p>Forget about stringly typed objects, from request to response, everything has types.</p> <p>Forget about stringly typed objects, from request to response, everything has types.</p>
<h2> <h2>
<i class="fa fa-fw fa-battery-full" aria-hidden="true"></i> <i class="fa fa-fw fa-battery-full" aria-hidden="true"></i>
Feature Rich Feature Rich
</h2> </h2>
<p>Actix provides a lot of features out of box. WebSockets, HTTP/2, pipelining etc.</p> <p>Actix provides a lot of features out of box. WebSockets, HTTP/2, pipelining etc.</p>
<h2> <h2>
<i class="fa fa-fw fa-puzzle-piece" aria-hidden="true"></i> <i class="fa fa-fw fa-puzzle-piece" aria-hidden="true"></i>
Extensible Extensible
</h2> </h2>
<p>Easily create your own libraries that any Actix application can use.</p> <p>Easily create your own libraries that any Actix application can use.</p>
<h2> <h2>
<i class="fa fa-fw fa-dashboard" aria-hidden="true"></i> <i class="fa fa-fw fa-dashboard" aria-hidden="true"></i>
@ -35,10 +36,9 @@
</h2> </h2>
<p>Actix is blazingly fast. Don't take our word for it -- <a href="https://www.techempower.com/benchmarks/#section=data-r16&hw=ph&test=plaintext">see for yourself!</a></p> <p>Actix is blazingly fast. Don't take our word for it -- <a href="https://www.techempower.com/benchmarks/#section=data-r16&hw=ph&test=plaintext">see for yourself!</a></p>
</div> </div>
</div> <div class="col-md-8">
<div class="col-md-8"> <div class="actix-content">
<div class="actix-content"> {{ highlight `extern crate actix_web;
{{ highlight `extern crate actix_web;
use actix_web::{server, App, HttpRequest, Responder}; use actix_web::{server, App, HttpRequest, Responder};
fn greet(req: HttpRequest) -> impl Responder { fn greet(req: HttpRequest) -> impl Responder {
@ -56,19 +56,19 @@ fn main() {
.expect("Can not bind to port 8000") .expect("Can not bind to port 8000")
.run(); .run();
}` "rust" "" }} }` "rust" "" }}
</div>
</div> </div>
</div> </div>
</div> <div class="actix-showcase">
<div class="actix-showcase"> <div class="col-md-9">
<div class="col-md-9"> <div class="actix-feature" id="responders">
<div class="actix-feature" id="responders"> <h2>Flexible Responders</h2>
<h2>Flexible Responders</h2> <p>
<p> Handler functions in actix can return a wide range of objects that
Handler functions in actix can return a wide range of objects that implement the <code>Responder</code> trait. This makes it a breeze
implement the <code>Responder</code> trait. This makes it a breeze to return consistent responses from your APIs.
to return consistent responses from your APIs. </p>
</p> {{ highlight `#[derive(Serialize)]
{{ highlight `#[derive(Serialize)]
struct Measurement { struct Measurement {
temperature: f32, temperature: f32,
} }
@ -80,17 +80,17 @@ fn hello_world() -> impl Responder {
fn current_temperature(_req: HttpRequest) -> impl Responder { fn current_temperature(_req: HttpRequest) -> impl Responder {
Json(Measurement { temperature: 42.3 }) Json(Measurement { temperature: 42.3 })
}` "rust" "" }} }` "rust" "" }}
</div> </div>
<div class="actix-feature" id="extractors"> <div class="actix-feature" id="extractors">
<h2>Powerful Extractors</h2> <h2>Powerful Extractors</h2>
<p> <p>
Actix comes with a powerful extractor system that extracts data Actix comes with a powerful extractor system that extracts data
from the incoming HTTP request and passes it to your view functions. from the incoming HTTP request and passes it to your view functions.
Not only does this make for a convenient API but it also means that Not only does this make for a convenient API but it also means that
your view functions can be synchronous code and still benefit your view functions can be synchronous code and still benefit
from asynchronous IO handling. from asynchronous IO handling.
</p> </p>
{{ highlight `#[derive(Deserialize)] {{ highlight `#[derive(Deserialize)]
struct Event { struct Event {
timestamp: f64, timestamp: f64,
kind: String, kind: String,
@ -101,15 +101,15 @@ fn capture_event(evt: Json<Event>) -> impl Responder {
let id = store_event_in_db(evt.timestamp, evt.kind, evt.tags); let id = store_event_in_db(evt.timestamp, evt.kind, evt.tags);
format!("got event {}", id) format!("got event {}", id)
}` "rust" "" }} }` "rust" "" }}
</div> </div>
<div class="actix-feature" id="forms"> <div class="actix-feature" id="forms">
<h2>Easy Form Handling</h2> <h2>Easy Form Handling</h2>
<p> <p>
Handling multipart/urlencoded form data is easy. Just define Handling multipart/urlencoded form data is easy. Just define
a structure that can be deserialized and actix will handle a structure that can be deserialized and actix will handle
the rest. the rest.
</p> </p>
{{ highlight `#[derive(Deserialize)] {{ highlight `#[derive(Deserialize)]
struct Register { struct Register {
username: String, username: String,
country: String, country: String,
@ -118,15 +118,15 @@ struct Register {
fn register(data: Form<Register>) -> impl Responder { fn register(data: Form<Register>) -> impl Responder {
format!("Hello {} from {}!", data.username, data.country) format!("Hello {} from {}!", data.username, data.country)
}` "rust" "" }} }` "rust" "" }}
</div> </div>
<div class="actix-feature" id="routing"> <div class="actix-feature" id="routing">
<h2>Request Routing</h2> <h2>Request Routing</h2>
<p> <p>
An actix app comes with a URL routing system that lets you match on An actix app comes with a URL routing system that lets you match on
URLs and invoke individual handlers. For extra flexibility, scopes URLs and invoke individual handlers. For extra flexibility, scopes
can be used. can be used.
</p> </p>
{{ highlight `fn index(req: HttpRequest) -> impl Responder { {{ highlight `fn index(req: HttpRequest) -> impl Responder {
"Hello from the index page" "Hello from the index page"
} }
@ -140,15 +140,16 @@ fn main() {
.resource("/hello/{name}", |r| r.method(Method::Get).with(hello)) .resource("/hello/{name}", |r| r.method(Method::Get).with(hello))
.finish(); .finish();
}` "rust" "" }} }` "rust" "" }}
</div>
</div>
<div class="col-md-3 actix-feature-selectors">
<ul>
<li class="actix-feature-selector"><a href="#responders">flexible responders</label>
<li class="actix-feature-selector"><a href="#extractors">powerful extractors</label>
<li class="actix-feature-selector"><a href="#forms">easy form handling</label>
<li class="actix-feature-selector"><a href="#routing">request routing</label>
</ul>
</div> </div>
</div>
<div class="col-md-3 actix-feature-selectors">
<ul>
<li class="actix-feature-selector"><a href="#responders">flexible responders</label>
<li class="actix-feature-selector"><a href="#extractors">powerful extractors</label>
<li class="actix-feature-selector"><a href="#forms">easy form handling</label>
<li class="actix-feature-selector"><a href="#routing">request routing</label>
</ul>
</div> </div>
</div> </div>
</div> </div>

View File

@ -16,4 +16,4 @@
<script src="/js/actix.js"></script> <script src="/js/actix.js"></script>
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}
</body> </body>
</html> </html>

View File

@ -28,19 +28,28 @@
<div class="navbar-collapse collapse" id="actix-main-nav"> <div class="navbar-collapse collapse" id="actix-main-nav">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="nav-item hd-lg-down"> <li class="nav-item hd-lg-down">
<a class="navbar-brand" href="/"><img src="/img/logo-nav.png" class="align-middle" alt=""></a> <a class="navbar-brand" href="{{ "/" | absLangURL }}"><img src="/img/logo-nav.png" class="align-middle" alt=""></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/">Home</a> <a class="nav-link" href="{{ "/" | absLangURL }}">{{ T "home" }}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/docs/">Documentation</a> <a class="nav-link" href="{{ "/docs/" | absLangURL }}">{{ T "docs" }}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/community/">Community</a> <a class="nav-link" href="{{ "/community/" | absLangURL }}">{{ T "community" }}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/code/">Code</a> <a class="nav-link" href="{{ "/code/" | absLangURL }}">{{ T "code" }}</a>
</li>
<li class="nav-item language-selector">
<i class="fa fa-fw fa-globe" aria-hidden="false"></i>
<ul class="subitem">
{{ range $.Site.Home.AllTranslations }}
<li class="submenu-item"><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
<li ><a href="https://actix-cn.github.io/">中文</a></li>
</ul>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -169,17 +169,47 @@ img {
line-height: 60px; line-height: 60px;
height: 60px; height: 60px;
padding-top: 0; padding-top: 0;
list-style: none;
}
.navbar-nav .language-selector {
position: relative;
}
.navbar-nav .language-selector ul.subitem {
display: none;
position: absolute;
right: 0;
}
.navbar-nav .language-selector:hover .subitem {
margin: 0;
padding: 0;
display: block;
background-color: #dcfaf7;
}
.navbar-nav .language-selector ul li {
padding: 0;
margin: 0;
height: auto;
line-height: 1;
}
.navbar-nav .language-selector ul li a {
display: block;
padding: 1em;
} }
.doctoggle { .doctoggle {
margin: -1rem 0 2rem 0; margin: -1rem 0 2rem 0;
display: none; display: none;
} }
.leftnav { .leftnav {
margin: 0 -1rem; margin: 0 -1rem;
padding: 0 1rem; padding: 0 1rem;
} }
.leftnav li { .leftnav li {
margin: 1rem 0rem; margin: 1rem 0rem;
@ -372,6 +402,7 @@ img {
color: #333!important; color: #333!important;
text-decoration: none; text-decoration: none;
} }
/* /*
* *
@ -560,7 +591,13 @@ h5:hover a {
.actix-footer-social a .fa-github { .actix-footer-social a .fa-github {
margin-right: 1rem; margin-right: 1rem;
} }
.navbar-nav .language-selector:hover .subitem {
margin: 0 -2rem 0 -1rem;
display: block;
background-color: #e8f9fc;
}
} }
@media (min-width: 480px) and (max-width: 576px) { @media (min-width: 480px) and (max-width: 576px) {
header .nav { header .nav {
width: 100%; width: 100%;
@ -600,3 +637,33 @@ h5:hover a {
width: 88%; width: 88%;
} }
} }
#act-cn-tabs {
padding: 2rem 2rem 1rem 2rem;
margin: 2rem auto;
background:#dceaea;
}
.act-menu li{
text-align:center;
line-height:44px;
font-size:15px;
overflow:hidden;
}
.act-menu li.off{
padding: 0 1.5rem;
background:#FFFFFF;
color:#589c9e;
font-weight:bold;
}
@media (min-width: 768px) {
#act-cn-tabs {
display: flex;
flex-flow: row;
padding: 2rem 1rem 1rem 2rem;
}
#act-cn-tabs #content {
width: 77%;
}
}

View File

@ -36,3 +36,4 @@
initFeatureSelector(); initFeatureSelector();
}); });
})(); })();