Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parity-test-sync
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
parity-test-sync
Commits
cb5ec8c0
Commit
cb5ec8c0
authored
9 years ago
by
Marek Kotewicz
Browse files
Options
Downloads
Patches
Plain Diff
decodable implementations
parent
0de75185
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/rlp/faces.rs
+1
-1
1 addition, 1 deletion
src/rlp/faces.rs
src/rlp/untrusted_rlp.rs
+14
-6
14 additions, 6 deletions
src/rlp/untrusted_rlp.rs
with
15 additions
and
7 deletions
src/rlp/faces.rs
+
1
−
1
View file @
cb5ec8c0
...
@@ -37,7 +37,7 @@ pub trait Decoder {
...
@@ -37,7 +37,7 @@ pub trait Decoder {
}
}
pub
trait
Decodable
:
Sized
{
pub
trait
Decodable
:
Sized
{
fn
decode
<
T
,
D
>
(
decoder
:
&
D
)
->
Result
<
T
,
DecoderError
>
where
D
:
Decoder
;
fn
decode
<
D
>
(
decoder
:
&
D
)
->
Result
<
Self
,
DecoderError
>
where
D
:
Decoder
;
}
}
pub
trait
View
<
'a
,
'view
>
:
Sized
{
pub
trait
View
<
'a
,
'view
>
:
Sized
{
...
...
This diff is collapsed.
Click to expand it.
src/rlp/untrusted_rlp.rs
+
14
−
6
View file @
cb5ec8c0
...
@@ -312,19 +312,27 @@ impl<'a> Decoder for BasicDecoder<'a> {
...
@@ -312,19 +312,27 @@ impl<'a> Decoder for BasicDecoder<'a> {
}
}
impl
<
T
>
Decodable
for
T
where
T
:
FromBytes
{
impl
<
T
>
Decodable
for
T
where
T
:
FromBytes
{
fn
decode
<
R
,
D
>
(
decoder
:
&
D
)
->
Result
<
R
,
DecoderError
>
where
D
:
Decoder
{
fn
decode
<
D
>
(
decoder
:
&
D
)
->
Result
<
Self
,
DecoderError
>
where
D
:
Decoder
{
unimplemented!
()
decoder
.read_value
(|
bytes
|
{
Ok
(
try
!
(
T
::
from_bytes
(
bytes
)))
})
}
}
}
}
impl
<
T
>
Decodable
for
Vec
<
T
>
where
T
:
Decodable
{
impl
<
T
>
Decodable
for
Vec
<
T
>
where
T
:
Decodable
{
fn
decode
<
R
,
D
>
(
decoder
:
&
D
)
->
Result
<
R
,
DecoderError
>
where
D
:
Decoder
{
fn
decode
<
D
>
(
decoder
:
&
D
)
->
Result
<
Self
,
DecoderError
>
where
D
:
Decoder
{
unimplemented!
()
decoder
.read_list
(|
decoders
|
{
decoders
.iter
()
.map
(|
d
|
T
::
decode
(
d
))
.collect
()
})
}
}
}
}
impl
Decodable
for
Vec
<
u8
>
{
impl
Decodable
for
Vec
<
u8
>
{
fn
decode
<
R
,
D
>
(
decoder
:
&
D
)
->
Result
<
R
,
DecoderError
>
where
D
:
Decoder
{
fn
decode
<
D
>
(
decoder
:
&
D
)
->
Result
<
Self
,
DecoderError
>
where
D
:
Decoder
{
unimplemented!
()
decoder
.read_value
(|
bytes
|
{
let
mut
res
=
vec!
[];
res
.extend
(
bytes
);
Ok
(
res
)
})
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment