Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
d218509f
Commit
d218509f
authored
Oct 24, 2019
by
Michael Müller
Committed by
Hero Bird
Oct 24, 2019
Browse files
Encode selectors as 4-byte array of hex strings (#214)
parent
48fb16f0
Pipeline
#54880
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
abi/src/specs.rs
View file @
d218509f
...
...
@@ -808,7 +808,10 @@ fn serialize_selector<S>(s: &[u8; 4], serializer: S) -> Result<S::Ok, S::Error>
where
S
:
Serializer
,
{
let
hex
=
format!
(
"0x{:02X}{:02X}{:02X}{:02X}"
,
s
[
0
],
s
[
1
],
s
[
2
],
s
[
3
]);
let
hex
=
format!
(
r#"["0x{:02X}","0x{:02X}","0x{:02X}","0x{:02X}"]"#
,
s
[
0
],
s
[
1
],
s
[
2
],
s
[
3
]
);
serializer
.serialize_str
(
&
hex
)
}
...
...
@@ -834,7 +837,7 @@ mod tests {
// then
assert_eq!
(
json
,
"{
\
"
name
\
"
:1,
\
"
selector
\
"
:
\"
0x07
5BCD
15
\"
,
\
"
args
\
"
:[],
\
"
docs
\
"
:[]}"
r#
"{"name":1,"selector":
"[
\"0x07
\",\"0x5B\",\"0xCD\",\"0x
15\"
]"
,"args":[],"docs":[]}"
#
);
}
}
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment