Skip to content

Commit d36c71b

Browse files
committed
Improve object_types rev
1 parent 9576629 commit d36c71b

3 files changed

Lines changed: 113 additions & 1 deletion

File tree

.github/workflows/lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on: ["push"]
2+
3+
name: Build
4+
5+
jobs:
6+
fmt:
7+
name: Format
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout sources
11+
uses: actions/checkout@v2
12+
13+
- name: Install stable toolchain
14+
uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: stable
18+
override: true
19+
components: rustfmt
20+
21+
- name: Run cargo fmt
22+
uses: actions-rs/cargo@v1
23+
with:
24+
command: fmt
25+
args: -- --check
26+
27+
clippy:
28+
name: Clippy
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout sources
32+
uses: actions/checkout@v2
33+
34+
- name: Install stable toolchain
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
profile: minimal
38+
toolchain: stable
39+
override: true
40+
components: clippy
41+
42+
- name: Run cargo clippy
43+
uses: actions-rs/cargo@v1
44+
with:
45+
command: clippy
46+
args: -- -D warnings

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
name: Release Build
7+
8+
jobs:
9+
linux:
10+
name: Build on Linux
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout sources
14+
uses: actions/checkout@v2
15+
16+
- name: Install stable toolchain
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
profile: minimal
20+
toolchain: stable
21+
override: true
22+
23+
- name: Run cargo build
24+
uses: actions-rs/cargo@v1
25+
with:
26+
command: build
27+
args: --release
28+
29+
- name: Upload build artifact
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: paradox-server-linux
33+
path: target/release/paradox-server
34+
35+
windows:
36+
name: Build on Windows
37+
runs-on: windows-latest
38+
steps:
39+
- name: Checkout sources
40+
uses: actions/checkout@v2
41+
42+
- name: Install stable toolchain
43+
uses: actions-rs/toolchain@v1
44+
with:
45+
profile: minimal
46+
toolchain: stable
47+
override: true
48+
49+
- name: Run cargo build
50+
uses: actions-rs/cargo@v1
51+
with:
52+
command: build
53+
args: --release
54+
55+
- name: Upload build artifact
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: paradox-server-windows
59+
path: target/release/paradox-server.exe

src/api/rev_lookup.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,11 @@ struct ObjectIDs<'a, T> {
469469
object_ids: &'a [T],
470470
}
471471

472+
#[derive(Serialize)]
473+
struct ObjectTypeEmbedded<'a, 'b> {
474+
objects: TypedTableIterAdapter<'a, 'b, ObjectsRef<'a, 'b>, IdentityHash, &'b [i32]>,
475+
}
476+
472477
fn rev_object_type_api(
473478
db: &TypedDatabase,
474479
rev: Rev,
@@ -481,7 +486,9 @@ fn rev_object_type_api(
481486
data: ObjectIDs {
482487
object_ids: objects.as_ref(),
483488
},
484-
embedded: TypedTableIterAdapter::<ObjectsRef, _, _>::new(&db.objects, objects),
489+
embedded: ObjectTypeEmbedded {
490+
objects: TypedTableIterAdapter::new(&db.objects, objects),
491+
},
485492
};
486493
warp::reply::json(&rep)
487494
}))

0 commit comments

Comments
 (0)