Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
ink
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
parity
ink
Commits
12f7c49f
Commit
12f7c49f
authored
Feb 17, 2019
by
Hero Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[pdsl_model] Remove const-forcing test code again
parent
d938c716
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
52 deletions
+20
-52
model/src/test.rs
model/src/test.rs
+20
-52
No files found.
model/src/test.rs
View file @
12f7c49f
...
...
@@ -22,58 +22,26 @@ messages! {
1
=>
Get
()
->
u32
;
}
use
crate
::{
MessageHandler
,
MessageHandlerMut
,
msg_handler
::
UnreachableMessageHandler
};
const
INSTANCE
:
ContractInstance
<
Adder
,
u32
,
(
MessageHandler
<
Get
,
Adder
>
,
(
MessageHandlerMut
<
Inc
,
Adder
>
,
UnreachableMessageHandler
)
)
>
=
{
ContractDecl
::
new
::
<
Adder
>
()
.on_deploy
(|
env
,
init_val
|
{
env
.state.val
.set
(
init_val
)
})
.on_msg_mut
::
<
Inc
>
(|
env
,
by
|
{
env
.state.val
+=
by
})
.on_msg
::
<
Get
>
(|
env
,
_
|
{
*
env
.state.val
.get
()
})
.instantiate
()
};
fn
instantiate
()
->
impl
Contract
{
ContractDecl
::
new
::
<
Adder
>
()
.on_deploy
(|
env
,
init_val
|
{
env
.state.val
.set
(
init_val
)
})
.on_msg_mut
::
<
Inc
>
(|
env
,
by
|
{
env
.state.val
+=
by
})
.on_msg
::
<
Get
>
(|
env
,
_
|
{
*
env
.state.val
.get
()
})
.instantiate
()
}
// const fn instantiate() -> impl Contract {
// ContractDecl::new::<Adder>()
// .on_deploy(|env, init_val| {
// env.state.val.set(init_val)
// })
// .on_msg_mut::<Inc>(|env, by| {
// env.state.val += by
// })
// .on_msg::<Get>(|env, _| {
// *env.state.val.get()
// })
// .instantiate()
// #[no_mangle]
// fn deploy() {
// instantiate().deploy()
// }
#[no_mangle]
fn
deploy
()
{
INSTANCE
.deploy
()
// instantiate().deploy()
}
#[no_mangle]
fn
call
()
{
INSTANCE
.dispatch
()
// instantiate().dispatch()
}
// #[no_mangle]
// fn call() {
// instantiate().dispatch()
// }
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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