1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

Correct some items' name to fix the build (#370)

This commit is contained in:
Yuki Okushi 2020-09-20 06:17:56 +09:00 committed by GitHub
parent a1f2f9514e
commit b727e796b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 229 additions and 14 deletions

225
Cargo.lock generated
View File

@ -1,5 +1,15 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
dependencies = [
"lazy_static",
"regex",
]
[[package]]
name = "actix"
version = "0.9.0"
@ -964,13 +974,100 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90f47c78ea98277cb1f5e6f60ba4fc762f5eafe9f6511bc2f7dfd8b75c225650"
dependencies = [
"async-io",
"futures-lite",
"futures-lite 0.1.11",
"multitask",
"parking 1.0.6",
"scoped-tls",
"waker-fn",
]
[[package]]
name = "async-graphql"
version = "2.0.0-alpha.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0a00bd676140e0b4b9dfee0e2cb6dbd69f31819c047c66593bb98e6c666d9d"
dependencies = [
"async-graphql-derive",
"async-graphql-parser",
"async-stream",
"async-trait",
"blocking 1.0.0",
"bson",
"bytes 0.5.6",
"chrono",
"chrono-tz",
"fnv",
"futures 0.3.5",
"indexmap",
"itertools 0.9.0",
"log",
"multer",
"once_cell",
"pin-project-lite",
"regex",
"serde 1.0.116",
"serde_json",
"spin",
"tempfile",
"thiserror",
"tracing",
"url",
"uuid 0.8.1",
]
[[package]]
name = "async-graphql-actix-web"
version = "2.0.0-alpha.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a27f2466c6ba1e8efe6cdfa77cbed7d4305d17f489ba3e7a3fcf27dba6d87842"
dependencies = [
"actix 0.10.0",
"actix-http 2.0.0",
"actix-rt",
"actix-web 3.0.0",
"actix-web-actors 3.0.0",
"async-graphql",
"futures 0.3.5",
"serde_json",
]
[[package]]
name = "async-graphql-demo"
version = "0.1.0"
dependencies = [
"actix-web 3.0.0",
"async-graphql",
"async-graphql-actix-web",
"slab",
]
[[package]]
name = "async-graphql-derive"
version = "2.0.0-alpha.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28bc786e6d42bd7cc846aeb6e14cf155f35c3685e7a76d0da3d16237010f07b2"
dependencies = [
"Inflector",
"async-graphql-parser",
"itertools 0.9.0",
"proc-macro-crate",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn",
]
[[package]]
name = "async-graphql-parser"
version = "2.0.0-alpha.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3547382648cc78db136deced524a2d2d399e5ac14cae580ba0ce92a27a1a1779"
dependencies = [
"pest",
"pest_derive",
"serde 1.0.116",
"serde_json",
]
[[package]]
name = "async-io"
version = "0.1.11"
@ -979,7 +1076,7 @@ checksum = "3ae22a338d28c75b53702b66f77979062cb29675db376d99e451af4fa79dedb3"
dependencies = [
"cfg-if",
"concurrent-queue",
"futures-lite",
"futures-lite 0.1.11",
"libc",
"once_cell",
"parking 2.0.0",
@ -1009,12 +1106,12 @@ dependencies = [
"async-io",
"async-mutex",
"async-task",
"blocking",
"blocking 0.5.2",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
"futures-lite",
"futures-lite 0.1.11",
"kv-log-macro",
"log",
"memchr",
@ -1026,6 +1123,27 @@ dependencies = [
"wasm-bindgen-futures",
]
[[package]]
name = "async-stream"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3670df70cbc01729f901f94c887814b3c68db038aad1329a418bae178bc5295c"
dependencies = [
"async-stream-impl",
"futures-core",
]
[[package]]
name = "async-stream-impl"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70"
dependencies = [
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn",
]
[[package]]
name = "async-task"
version = "3.0.0"
@ -1362,7 +1480,21 @@ checksum = "ea5800d29218fea137b0880387e5948694a23c93fcdde157006966693a865c7c"
dependencies = [
"async-channel",
"atomic-waker",
"futures-lite",
"futures-lite 0.1.11",
"once_cell",
"waker-fn",
]
[[package]]
name = "blocking"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2640778f8053e72c11f621b0a5175a0560a269282aa98ed85107773ab8e2a556"
dependencies = [
"async-channel",
"atomic-waker",
"fastrand",
"futures-lite 1.7.0",
"once_cell",
"waker-fn",
]
@ -1387,6 +1519,22 @@ dependencies = [
"libc",
]
[[package]]
name = "bson"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11f16001d679cb13d14b2c93c7d0fa13bb484a87c34a6c4c39707ad936499b5"
dependencies = [
"base64 0.12.3",
"chrono",
"hex",
"lazy_static",
"linked-hash-map 0.5.3",
"rand",
"serde 1.0.116",
"serde_json",
]
[[package]]
name = "bstr"
version = "0.2.13"
@ -2385,6 +2533,21 @@ dependencies = [
"waker-fn",
]
[[package]]
name = "futures-lite"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b77e08e656f472d8ea84c472fa8b0a7a917883048e1cf2d4e34a323cd0aaf63"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"memchr",
"parking 2.0.0",
"pin-project-lite",
"waker-fn",
]
[[package]]
name = "futures-macro"
version = "0.3.5"
@ -2829,6 +2992,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.6"
@ -3304,6 +3476,25 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "multer"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99851e6ad01b0fbe086dda2dea00d68bb84fc7d7eae2c39ca7313da9197f4d31"
dependencies = [
"bytes 0.5.6",
"derive_more",
"encoding_rs",
"futures 0.3.5",
"http",
"httparse",
"lazy_static",
"log",
"mime",
"regex",
"twoway",
]
[[package]]
name = "multipart-async-std-example"
version = "0.3.0"
@ -3936,6 +4127,15 @@ dependencies = [
"syntect",
]
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.18"
@ -3992,7 +4192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72"
dependencies = [
"anyhow",
"itertools",
"itertools 0.8.2",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn",
@ -4651,6 +4851,7 @@ version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde 1.0.116",
@ -5476,9 +5677,21 @@ checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c"
dependencies = [
"cfg-if",
"log",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada"
dependencies = [
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.16"

View File

@ -6,6 +6,8 @@ edition = "2018"
[dependencies]
actix-web = "3.0.0"
async-graphql = "2.0.0-alpha.7"
async-graphql-actix-web = "2.0.0-alpha.7"
async-graphql = "=2.0.0-alpha.13"
async-graphql-actix-web = "=2.0.0-alpha.13"
slab = "0.4.2"

View File

@ -1,9 +1,9 @@
use super::StarWars;
use async_graphql::connection::{query, Connection, Edge, EmptyFields};
use async_graphql::{Context, FieldResult, GQLEnum, GQLInterface, GQLObject};
use async_graphql::{Context, Enum, FieldResult, Interface, Object};
/// One of the films in the Star Wars Trilogy
#[derive(GQLEnum, Copy, Clone, Eq, PartialEq)]
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
pub enum Episode {
/// Released in 1977.
NewHope,
@ -18,7 +18,7 @@ pub enum Episode {
pub struct Human(usize);
/// A humanoid creature in the Star Wars universe.
#[GQLObject]
#[Object]
impl Human {
/// The id of the human.
async fn id(&self, ctx: &Context<'_>) -> &str {
@ -53,7 +53,7 @@ impl Human {
pub struct Droid(usize);
/// A mechanical creature in the Star Wars universe.
#[GQLObject]
#[Object]
impl Droid {
/// The id of the droid.
async fn id(&self, ctx: &Context<'_>) -> &str {
@ -87,7 +87,7 @@ impl Droid {
pub struct QueryRoot;
#[GQLObject]
#[Object]
impl QueryRoot {
async fn hero(
&self,
@ -159,7 +159,7 @@ impl QueryRoot {
}
}
#[derive(GQLInterface)]
#[derive(Interface)]
#[graphql(
field(name = "id", type = "&str", context),
field(name = "name", type = "&str", context),