mirror of
https://github.com/actix/actix-website
synced 2025-06-29 16:24:58 +02:00
Merge branch 'master' into master
This commit is contained in:
@ -1,33 +1,34 @@
|
||||
{{ partial "header" . }}
|
||||
|
||||
<div class="jumbotron">
|
||||
<div class="actix-jumbotron">
|
||||
<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 id="act-home">
|
||||
<div class="jumbotron">
|
||||
<div class="actix-jumbotron">
|
||||
<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 class="container actix-home">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="actix-features">
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-shield" aria-hidden="true"></i>
|
||||
Type Safe
|
||||
</h2>
|
||||
<p>Forget about stringly typed objects, from request to response, everything has types.</p>
|
||||
<div class="container actix-home">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="actix-features">
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-shield" aria-hidden="true"></i>
|
||||
Type Safe
|
||||
</h2>
|
||||
<p>Forget about stringly typed objects, from request to response, everything has types.</p>
|
||||
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-battery-full" aria-hidden="true"></i>
|
||||
Feature Rich
|
||||
</h2>
|
||||
<p>Actix provides a lot of features out of box. WebSockets, HTTP/2, pipelining etc.</p>
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-battery-full" aria-hidden="true"></i>
|
||||
Feature Rich
|
||||
</h2>
|
||||
<p>Actix provides a lot of features out of box. WebSockets, HTTP/2, pipelining etc.</p>
|
||||
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-puzzle-piece" aria-hidden="true"></i>
|
||||
Extensible
|
||||
</h2>
|
||||
<p>Easily create your own libraries that any Actix application can use.</p>
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-puzzle-piece" aria-hidden="true"></i>
|
||||
Extensible
|
||||
</h2>
|
||||
<p>Easily create your own libraries that any Actix application can use.</p>
|
||||
|
||||
<h2>
|
||||
<i class="fa fa-fw fa-dashboard" aria-hidden="true"></i>
|
||||
@ -35,10 +36,9 @@
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="actix-content">
|
||||
{{ highlight `extern crate actix_web;
|
||||
<div class="col-md-8">
|
||||
<div class="actix-content">
|
||||
{{ highlight `extern crate actix_web;
|
||||
use actix_web::{server, App, HttpRequest, Responder};
|
||||
|
||||
fn greet(req: HttpRequest) -> impl Responder {
|
||||
@ -56,19 +56,19 @@ fn main() {
|
||||
.expect("Can not bind to port 8000")
|
||||
.run();
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actix-showcase">
|
||||
<div class="col-md-9">
|
||||
<div class="actix-feature" id="responders">
|
||||
<h2>Flexible Responders</h2>
|
||||
<p>
|
||||
Handler functions in actix can return a wide range of objects that
|
||||
implement the <code>Responder</code> trait. This makes it a breeze
|
||||
to return consistent responses from your APIs.
|
||||
</p>
|
||||
{{ highlight `#[derive(Serialize)]
|
||||
<div class="actix-showcase">
|
||||
<div class="col-md-9">
|
||||
<div class="actix-feature" id="responders">
|
||||
<h2>Flexible Responders</h2>
|
||||
<p>
|
||||
Handler functions in actix can return a wide range of objects that
|
||||
implement the <code>Responder</code> trait. This makes it a breeze
|
||||
to return consistent responses from your APIs.
|
||||
</p>
|
||||
{{ highlight `#[derive(Serialize)]
|
||||
struct Measurement {
|
||||
temperature: f32,
|
||||
}
|
||||
@ -80,17 +80,17 @@ fn hello_world() -> impl Responder {
|
||||
fn current_temperature(_req: HttpRequest) -> impl Responder {
|
||||
Json(Measurement { temperature: 42.3 })
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
<div class="actix-feature" id="extractors">
|
||||
<h2>Powerful Extractors</h2>
|
||||
<p>
|
||||
Actix comes with a powerful extractor system that extracts data
|
||||
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
|
||||
your view functions can be synchronous code and still benefit
|
||||
from asynchronous IO handling.
|
||||
</p>
|
||||
{{ highlight `#[derive(Deserialize)]
|
||||
</div>
|
||||
<div class="actix-feature" id="extractors">
|
||||
<h2>Powerful Extractors</h2>
|
||||
<p>
|
||||
Actix comes with a powerful extractor system that extracts data
|
||||
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
|
||||
your view functions can be synchronous code and still benefit
|
||||
from asynchronous IO handling.
|
||||
</p>
|
||||
{{ highlight `#[derive(Deserialize)]
|
||||
struct Event {
|
||||
timestamp: f64,
|
||||
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);
|
||||
format!("got event {}", id)
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
<div class="actix-feature" id="forms">
|
||||
<h2>Easy Form Handling</h2>
|
||||
<p>
|
||||
Handling multipart/urlencoded form data is easy. Just define
|
||||
a structure that can be deserialized and actix will handle
|
||||
the rest.
|
||||
</p>
|
||||
{{ highlight `#[derive(Deserialize)]
|
||||
</div>
|
||||
<div class="actix-feature" id="forms">
|
||||
<h2>Easy Form Handling</h2>
|
||||
<p>
|
||||
Handling multipart/urlencoded form data is easy. Just define
|
||||
a structure that can be deserialized and actix will handle
|
||||
the rest.
|
||||
</p>
|
||||
{{ highlight `#[derive(Deserialize)]
|
||||
struct Register {
|
||||
username: String,
|
||||
country: String,
|
||||
@ -118,15 +118,15 @@ struct Register {
|
||||
fn register(data: Form<Register>) -> impl Responder {
|
||||
format!("Hello {} from {}!", data.username, data.country)
|
||||
}` "rust" "" }}
|
||||
</div>
|
||||
<div class="actix-feature" id="routing">
|
||||
<h2>Request Routing</h2>
|
||||
<p>
|
||||
An actix app comes with a URL routing system that lets you match on
|
||||
URLs and invoke individual handlers. For extra flexibility, scopes
|
||||
can be used.
|
||||
</p>
|
||||
{{ highlight `fn index(req: HttpRequest) -> impl Responder {
|
||||
</div>
|
||||
<div class="actix-feature" id="routing">
|
||||
<h2>Request Routing</h2>
|
||||
<p>
|
||||
An actix app comes with a URL routing system that lets you match on
|
||||
URLs and invoke individual handlers. For extra flexibility, scopes
|
||||
can be used.
|
||||
</p>
|
||||
{{ highlight `fn index(req: HttpRequest) -> impl Responder {
|
||||
"Hello from the index page"
|
||||
}
|
||||
|
||||
@ -140,15 +140,16 @@ fn main() {
|
||||
.resource("/hello/{name}", |r| r.method(Method::Get).with(hello))
|
||||
.finish();
|
||||
}` "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 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>
|
||||
|
Reference in New Issue
Block a user