44
55use super :: {
66 elem_type:: ImmOrPNode ,
7- interface:: { ICommand , IInteger , INode } ,
7+ interface:: { ICommand , INode } ,
88 ivalue:: IValue ,
99 node_base:: { NodeAttributeBase , NodeBase , NodeElementBase } ,
1010 store:: { CacheStore , IntegerId , NodeStore , ValueStore } ,
@@ -59,7 +59,7 @@ impl ICommand for CommandNode {
5959 ) -> GenApiResult < ( ) > {
6060 cx. invalidate_cache_by ( self . node_base ( ) . id ( ) ) ;
6161
62- let value = self . command_value . value ( device, store, cx) ?;
62+ let value: i64 = self . command_value . value ( device, store, cx) ?;
6363 self . value . set_value ( value, device, store, cx)
6464 }
6565
@@ -71,15 +71,14 @@ impl ICommand for CommandNode {
7171 store : & impl NodeStore ,
7272 cx : & mut ValueCtxt < T , U > ,
7373 ) -> GenApiResult < bool > {
74- let nid = match self . value {
74+ let node = match self . value {
7575 ImmOrPNode :: Imm ( ..) => return Ok ( true ) ,
7676 ImmOrPNode :: PNode ( nid) => nid,
7777 } ;
7878
79- cx. invalidate_cache_of ( nid) ;
80- let node = nid. expect_iinteger_kind ( store) ?;
81- if node. is_readable ( device, store, cx) ? {
82- let command_value = self . command_value . value ( device, store, cx) ?;
79+ cx. invalidate_cache_of ( node) ;
80+ if IValue :: < i64 > :: is_readable ( & node, device, store, cx) ? {
81+ let command_value: i64 = self . command_value . value ( device, store, cx) ?;
8382 let reg_value = node. value ( device, store, cx) ?;
8483 Ok ( command_value != reg_value)
8584 } else {
@@ -97,6 +96,6 @@ impl ICommand for CommandNode {
9796 cx : & mut ValueCtxt < T , U > ,
9897 ) -> GenApiResult < bool > {
9998 Ok ( self . elem_base . is_writable ( device, store, cx) ?
100- && self . value . is_writable ( device, store, cx) ?)
99+ && IValue :: < i64 > :: is_writable ( & self . value , device, store, cx) ?)
101100 }
102101}
0 commit comments