Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Mirrored projects
polkadot-sdk
Commits
fa192357
Commit
fa192357
authored
2 years ago
by
yjh
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
chore: remove unused traits for wasm interface (#12792)
parent
6a5bac18
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/primitives/wasm-interface/src/lib.rs
+0
-42
0 additions, 42 deletions
substrate/primitives/wasm-interface/src/lib.rs
with
0 additions
and
42 deletions
substrate/primitives/wasm-interface/src/lib.rs
+
0
−
42
View file @
fa192357
...
...
@@ -627,48 +627,6 @@ impl_into_and_from_value! {
i64
,
I64
,
}
/// Something that can write a primitive to wasm memory location.
pub
trait
WritePrimitive
<
T
:
PointerType
>
{
/// Write the given value `t` to the given memory location `ptr`.
fn
write_primitive
(
&
mut
self
,
ptr
:
Pointer
<
T
>
,
t
:
T
)
->
Result
<
()
>
;
}
impl
WritePrimitive
<
u32
>
for
&
mut
dyn
FunctionContext
{
fn
write_primitive
(
&
mut
self
,
ptr
:
Pointer
<
u32
>
,
t
:
u32
)
->
Result
<
()
>
{
let
r
=
t
.to_le_bytes
();
self
.write_memory
(
ptr
.cast
(),
&
r
)
}
}
impl
WritePrimitive
<
u64
>
for
&
mut
dyn
FunctionContext
{
fn
write_primitive
(
&
mut
self
,
ptr
:
Pointer
<
u64
>
,
t
:
u64
)
->
Result
<
()
>
{
let
r
=
t
.to_le_bytes
();
self
.write_memory
(
ptr
.cast
(),
&
r
)
}
}
/// Something that can read a primitive from a wasm memory location.
pub
trait
ReadPrimitive
<
T
:
PointerType
>
{
/// Read a primitive from the given memory location `ptr`.
fn
read_primitive
(
&
self
,
ptr
:
Pointer
<
T
>
)
->
Result
<
T
>
;
}
impl
ReadPrimitive
<
u32
>
for
&
mut
dyn
FunctionContext
{
fn
read_primitive
(
&
self
,
ptr
:
Pointer
<
u32
>
)
->
Result
<
u32
>
{
let
mut
r
=
[
0u8
;
4
];
self
.read_memory_into
(
ptr
.cast
(),
&
mut
r
)
?
;
Ok
(
u32
::
from_le_bytes
(
r
))
}
}
impl
ReadPrimitive
<
u64
>
for
&
mut
dyn
FunctionContext
{
fn
read_primitive
(
&
self
,
ptr
:
Pointer
<
u64
>
)
->
Result
<
u64
>
{
let
mut
r
=
[
0u8
;
8
];
self
.read_memory_into
(
ptr
.cast
(),
&
mut
r
)
?
;
Ok
(
u64
::
from_le_bytes
(
r
))
}
}
/// Typed value that can be returned from a function.
///
/// Basically a `TypedValue` plus `Unit`, for functions which return nothing.
...
...
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