Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DecodeAsType backed by Visitor impls for standard types. #11

Merged
merged 70 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
bfd93a9
move things around to make space for DecodeAsType and proc macro crate
jsdw Jan 19, 2023
9912c87
make space for DecodeAsType and proc_macro
jsdw Jan 19, 2023
3e92b3c
add visit_unexpected to reduce boilerplate when wanting partial visitors
jsdw Jan 19, 2023
32a635d
enable zero-copy decoding via GATs
jsdw Jan 19, 2023
5d91cca
various reorganising, standardise visitor type functionality, expose …
jsdw Jan 19, 2023
1668ffe
WIP DecodeAsType impls with delegate_visitor_fns macro
jsdw Jan 23, 2023
6afd3f1
more decode/visitor impls and tidy up
jsdw Jan 23, 2023
83ac3a7
add more decode impls
jsdw Jan 24, 2023
896b869
fmt and add more imple for decode
jsdw Jan 24, 2023
4021bc1
add DecodeAsType tests and Bits impl
jsdw Jan 30, 2023
aba3e7e
various tidy up, more flexible Visitor errors allowed
jsdw Jan 31, 2023
78be0e2
replace delegate_visitor_impls with macro and 'and_then' method to tr…
jsdw Jan 31, 2023
c67a636
tweak example
jsdw Jan 31, 2023
a65a4f7
make it easier to decode from composite type with unnamed fields
jsdw Jan 31, 2023
0b1205b
avoid allocating when converting Composite to Tuple
jsdw Feb 1, 2023
450850a
first pass DecodeAsType proc macro impl
jsdw Feb 1, 2023
d59a57e
second pass over derive macro to add support for lifetimes, generics …
jsdw Feb 2, 2023
644bfc1
add some tests and allow decoding through 1-field tuple/composite
jsdw Feb 2, 2023
52f8ce0
Merge branch 'main' into jsdw-decode-as-type
jsdw Feb 2, 2023
b6ee043
cargo fmt
jsdw Feb 2, 2023
318b4f3
Fix up docs
jsdw Feb 2, 2023
f53e528
clippy appeasing
jsdw Feb 2, 2023
b04b1c8
more clippy appeasing
jsdw Feb 2, 2023
59f78db
remove copy/clone from visitor types to avoid accidental duplication …
jsdw Feb 3, 2023
2d3a29b
Iterator for Array/Sequence too, base Sequence on Array, re-optimise …
jsdw Feb 3, 2023
17f2f7d
Simplify AndThen a little with an AndThenFn trait
jsdw Feb 3, 2023
6501b28
Nit: improve a bound
jsdw Feb 3, 2023
b6dbbf2
clippy
jsdw Feb 3, 2023
ac91d6e
update READMEs
jsdw Feb 3, 2023
238f4b4
add 'info lifetime to GAT too, so both can be passed through
jsdw Feb 4, 2023
9d0835c
add missing lifetime on variant name
jsdw Feb 5, 2023
7566183
standardise on bytes_from_start and bytes_from_undecoded
jsdw Feb 6, 2023
b30263a
add 'bail out' ability to regain decode_as_type flexibility
jsdw Feb 8, 2023
b3d38b2
tweak bail-out so we can properly map over it for things like AndThen…
jsdw Feb 9, 2023
c04b479
expose Path for composite and variant types
jsdw Feb 9, 2023
c1319c4
simplify AndThen somewhat; no need to manuallyt forward all visitor c…
jsdw Feb 9, 2023
b64f97c
actually, we don't need AndThen any more
jsdw Feb 9, 2023
adab7ba
generated visitor types to inherit visibility from original type
jsdw Feb 9, 2023
5b5947b
doc hidden on generated visitors
jsdw Feb 9, 2023
a096c71
decode key primitive-types
jsdw Feb 14, 2023
75d0c39
resolve a macro hygiene issue; no user defined field names
jsdw Feb 14, 2023
3e0d88f
decode Compact's
jsdw Feb 14, 2023
ba1570e
allow skipping over fields when decoding
jsdw Feb 22, 2023
36b7749
Add DecodeAsFields trait and impls/derive to allow field based decoding
jsdw Feb 22, 2023
ec21fe4
decode_as_field_ids
jsdw Feb 23, 2023
3f2bbd2
use scale-encode 0.0.17
jsdw Feb 23, 2023
fb381c6
consume bytes when DecodeAsType-ing
jsdw Feb 24, 2023
cd42fb2
disallow sequences to decode into tuples
jsdw Feb 27, 2023
d4fc0d4
bump scale-encode
jsdw Feb 27, 2023
4ab6773
support codec(skip) too for compat
jsdw Feb 28, 2023
bcc00bb
Ignore other codec attrs
jsdw Feb 28, 2023
109000b
scale-encode 0.1 and fmt
jsdw Feb 28, 2023
cae040c
Remove scale-encode dependency in tests
jsdw Mar 1, 2023
81c379d
update release steps
jsdw Mar 1, 2023
247cc35
cargo fmt
jsdw Mar 1, 2023
500aac3
improve top level docs
jsdw Mar 1, 2023
dcfd2be
slightly more lenient tuple decoding, and fix/run doc tests in CI
jsdw Mar 2, 2023
2c3f4a2
tweak release notes to ensure doc tests are run
jsdw Mar 2, 2023
b081903
add codeowners file
jsdw Mar 2, 2023
63fda21
fix typo, remove duplicate bound, and use &'a () to carry lifetime in…
jsdw Mar 3, 2023
f5dc39d
unwrap() into expect() to be clearer about issue if we hit it, and ad…
jsdw Mar 3, 2023
2d3c43e
Hide visitor structs behind const _ namespace too, and no need to gen…
jsdw Mar 3, 2023
1cc1985
fix typo and remove references to Context being a thing you pass in
jsdw Mar 3, 2023
5cd9c5c
Fix a couple more typos
jsdw Mar 3, 2023
7f148f1
remove cfg(feature = derive) on tests and just expect feature to be e…
jsdw Mar 3, 2023
ce16efd
fix various comment typos
jsdw Mar 3, 2023
bef7726
tuples should skip over bytes too, and be a touch more defensive in m…
jsdw Mar 3, 2023
8a79d7b
remove an old Cargo.lock that shouldn't exist
jsdw Mar 3, 2023
c293207
remove LinkedList; no longer needed
jsdw Mar 3, 2023
db3923c
fix copyright headers
jsdw Mar 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ jobs:
command: test
args: --all-targets --workspace

- name: Cargo test docs
uses: actions-rs/[email protected]
with:
command: test
args: --doc --workspace

clippy:
name: Cargo clippy
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
hard_tabs = true
hard_tabs = false
tab_spaces = 4
max_width = 100
use_small_heuristics = "Max"
edition = "2021"
5 changes: 5 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# main codeowner @paritytech/tools-team
* @paritytech/tools-team

# CI
/.github/ @paritytech/ci @paritytech/tools-team
30 changes: 5 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
[package]
name = "scale-decode"
version = "0.4.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/paritytech/scale-decode"
documentation = "https://docs.rs/scale-decode"
homepage = "https://www.parity.io/"
description = "Decode SCALE encoded bytes into arbitrary types at runtime"
keywords = ["parity", "scale", "decoding"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]

[dependencies]
scale-info = { version = "2.0.0", default-features = false, features = ["bit-vec", "std"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] }
thiserror = "1.0.24"
scale-bits = { version = "0.3.0" }

[dev-dependencies]
scale-info = { version = "2.0.0", default-features = false, features = ["bit-vec", "std", "derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
bitvec = "1"
[workspace]
members = [
"scale-decode",
"scale-decode-derive",
]
2 changes: 1 addition & 1 deletion FILE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022 Parity Technologies (UK) Ltd. ([email protected])
// Copyright (C) 2023 Parity Technologies (UK) Ltd. ([email protected])
// This file is a part of the scale-value crate.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading