File tree Expand file tree Collapse file tree 5 files changed +121
-0
lines changed
i18n/zh-CN/docusaurus-plugin-content-docs
current/reference/xlang-api
version-0.8/reference/xlang-api
versioned_docs/version-0.8/reference/xlang-api Expand file tree Collapse file tree 5 files changed +121
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ sidebar_position : 7
3
+ ---
4
+
5
+ # Rust API
6
+
7
+ ## Installation
8
+
9
+ ``` shell
10
+ cargo add --git https://github.com/kcl-lang/lib
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ``` rust
16
+ use kcl_lang :: * ;
17
+ use anyhow :: Result ;
18
+
19
+ fn main () -> Result <()> {
20
+ let api = API :: default ();
21
+ let args = & ExecProgramArgs {
22
+ k_filename_list : vec! [" main.k" . to_string ()],
23
+ k_code_list : vec! [" a = 1" . to_string ()],
24
+ .. Default :: default ()
25
+ };
26
+ let exec_result = api . exec_program (args )? ;
27
+ println! (" {}" , exec_result . yaml_result);
28
+ Ok (())
29
+ }
30
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ sidebar_position : 7
3
+ ---
4
+
5
+ # Rust API
6
+
7
+ ## 添加依赖
8
+
9
+ ``` shell
10
+ cargo add --git https://github.com/kcl-lang/lib
11
+ ```
12
+
13
+ ## 快速开始
14
+
15
+ ``` rust
16
+ use kcl_lang :: * ;
17
+ use anyhow :: Result ;
18
+
19
+ fn main () -> Result <()> {
20
+ let api = API :: default ();
21
+ let args = & ExecProgramArgs {
22
+ k_filename_list : vec! [" main.k" . to_string ()],
23
+ k_code_list : vec! [" a = 1" . to_string ()],
24
+ .. Default :: default ()
25
+ };
26
+ let exec_result = api . exec_program (args )? ;
27
+ println! (" {}" , exec_result . yaml_result);
28
+ Ok (())
29
+ }
30
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ sidebar_position : 7
3
+ ---
4
+
5
+ # Rust API
6
+
7
+ ## 添加依赖
8
+
9
+ ``` shell
10
+ cargo add --git https://github.com/kcl-lang/lib
11
+ ```
12
+
13
+ ## 快速开始
14
+
15
+ ``` rust
16
+ use kcl_lang :: * ;
17
+ use anyhow :: Result ;
18
+
19
+ fn main () -> Result <()> {
20
+ let api = API :: default ();
21
+ let args = & ExecProgramArgs {
22
+ k_filename_list : vec! [" main.k" . to_string ()],
23
+ k_code_list : vec! [" a = 1" . to_string ()],
24
+ .. Default :: default ()
25
+ };
26
+ let exec_result = api . exec_program (args )? ;
27
+ println! (" {}" , exec_result . yaml_result);
28
+ Ok (())
29
+ }
30
+ ```
Original file line number Diff line number Diff line change
1
+ Subproject commit 465a39c29ebc890275802de0b5388d823762f5cd
Original file line number Diff line number Diff line change
1
+ ---
2
+ sidebar_position : 7
3
+ ---
4
+
5
+ # Rust API
6
+
7
+ ## Installation
8
+
9
+ ``` shell
10
+ cargo add --git https://github.com/kcl-lang/lib
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ``` rust
16
+ use kcl_lang :: * ;
17
+ use anyhow :: Result ;
18
+
19
+ fn main () -> Result <()> {
20
+ let api = API :: default ();
21
+ let args = & ExecProgramArgs {
22
+ k_filename_list : vec! [" main.k" . to_string ()],
23
+ k_code_list : vec! [" a = 1" . to_string ()],
24
+ .. Default :: default ()
25
+ };
26
+ let exec_result = api . exec_program (args )? ;
27
+ println! (" {}" , exec_result . yaml_result);
28
+ Ok (())
29
+ }
30
+ ```
You can’t perform that action at this time.
0 commit comments