File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/canisters/frontend/ic-certified-assets/src Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,20 @@ thread_local! {
32
32
static STATE : RefCell <State > = RefCell :: new( State :: default ( ) ) ;
33
33
}
34
34
35
+ pub fn with_state < F , R > ( f : F ) -> R
36
+ where
37
+ F : FnOnce ( & State ) -> R ,
38
+ {
39
+ STATE . with ( |s| f ( & s. borrow ( ) ) )
40
+ }
41
+
42
+ pub fn with_state_mut < F , R > ( f : F ) -> R
43
+ where
44
+ F : FnOnce ( & mut State ) -> R ,
45
+ {
46
+ STATE . with ( |s| f ( & mut s. borrow_mut ( ) ) )
47
+ }
48
+
35
49
#[ query]
36
50
#[ candid_method( query) ]
37
51
fn api_version ( ) -> u16 {
@@ -387,11 +401,11 @@ fn can(permission: Permission) -> Result<(), String> {
387
401
} )
388
402
}
389
403
390
- fn can_commit ( ) -> Result < ( ) , String > {
404
+ pub fn can_commit ( ) -> Result < ( ) , String > {
391
405
can ( Permission :: Commit )
392
406
}
393
407
394
- fn can_prepare ( ) -> Result < ( ) , String > {
408
+ pub fn can_prepare ( ) -> Result < ( ) , String > {
395
409
can ( Permission :: Prepare )
396
410
}
397
411
You can’t perform that action at this time.
0 commit comments