wasmlib/coreblob/
contract.rs1#![allow(dead_code)]
9
10use crate::*;
11use crate::coreblob::*;
12
13pub struct StoreBlobCall<'a> {
14 pub func: ScFunc<'a>,
15 pub params: MutableStoreBlobParams,
16 pub results: ImmutableStoreBlobResults,
17}
18
19pub struct GetBlobFieldCall<'a> {
20 pub func: ScView<'a>,
21 pub params: MutableGetBlobFieldParams,
22 pub results: ImmutableGetBlobFieldResults,
23}
24
25pub struct GetBlobInfoCall<'a> {
26 pub func: ScView<'a>,
27 pub params: MutableGetBlobInfoParams,
28 pub results: ImmutableGetBlobInfoResults,
29}
30
31pub struct ListBlobsCall<'a> {
32 pub func: ScView<'a>,
33 pub results: ImmutableListBlobsResults,
34}
35
36pub struct ScFuncs {
37}
38
39impl ScFuncs {
40 pub fn store_blob(ctx: &impl ScFuncCallContext) -> StoreBlobCall {
41 let mut f = StoreBlobCall {
42 func: ScFunc::new(ctx, HSC_NAME, HFUNC_STORE_BLOB),
43 params: MutableStoreBlobParams { proxy: Proxy::nil() },
44 results: ImmutableStoreBlobResults { proxy: Proxy::nil() },
45 };
46 ScFunc::link_params(&mut f.params.proxy, &f.func);
47 ScFunc::link_results(&mut f.results.proxy, &f.func);
48 f
49 }
50
51 pub fn get_blob_field(ctx: &impl ScViewCallContext) -> GetBlobFieldCall {
52 let mut f = GetBlobFieldCall {
53 func: ScView::new(ctx, HSC_NAME, HVIEW_GET_BLOB_FIELD),
54 params: MutableGetBlobFieldParams { proxy: Proxy::nil() },
55 results: ImmutableGetBlobFieldResults { proxy: Proxy::nil() },
56 };
57 ScView::link_params(&mut f.params.proxy, &f.func);
58 ScView::link_results(&mut f.results.proxy, &f.func);
59 f
60 }
61
62 pub fn get_blob_info(ctx: &impl ScViewCallContext) -> GetBlobInfoCall {
63 let mut f = GetBlobInfoCall {
64 func: ScView::new(ctx, HSC_NAME, HVIEW_GET_BLOB_INFO),
65 params: MutableGetBlobInfoParams { proxy: Proxy::nil() },
66 results: ImmutableGetBlobInfoResults { proxy: Proxy::nil() },
67 };
68 ScView::link_params(&mut f.params.proxy, &f.func);
69 ScView::link_results(&mut f.results.proxy, &f.func);
70 f
71 }
72
73 pub fn list_blobs(ctx: &impl ScViewCallContext) -> ListBlobsCall {
74 let mut f = ListBlobsCall {
75 func: ScView::new(ctx, HSC_NAME, HVIEW_LIST_BLOBS),
76 results: ImmutableListBlobsResults { proxy: Proxy::nil() },
77 };
78 ScView::link_results(&mut f.results.proxy, &f.func);
79 f
80 }
81}