Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6ba9ecb4
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6ba9ecb4
编写于
6月 17, 2022
作者:
D
dingbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: rust
上级
70504d88
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
6 deletion
+6
-6
docs/en/05-develop/01-connect/04-rust.md
docs/en/05-develop/01-connect/04-rust.md
+3
-3
docs/examples/rust/cloud-example/Cargo.toml
docs/examples/rust/cloud-example/Cargo.toml
+2
-2
docs/examples/rust/cloud-example/src/main.rs
docs/examples/rust/cloud-example/src/main.rs
+1
-1
未找到文件。
docs/en/05-develop/01-connect/04-rust.md
浏览文件 @
6ba9ecb4
...
@@ -9,14 +9,14 @@ import TabItem from '@theme/TabItem';
...
@@ -9,14 +9,14 @@ import TabItem from '@theme/TabItem';
## Create Project
## Create Project
```
```
cargo new
cloud_
example
cargo new
--bin cloud-
example
```
```
## Add Dependency
## Add Dependency
Add dependency to
`Cargo.toml`
.
Add dependency to
`Cargo.toml`
.
```
toml title="Cargo.toml"
```
toml title="Cargo.toml"
{{#include docs/examples/rust/cloud
_
example/Cargo.toml}}
{{#include docs/examples/rust/cloud
-
example/Cargo.toml}}
```
```
## Config
## Config
...
@@ -59,7 +59,7 @@ Replace <DSN\> with real TDengine cloud DSN. To obtain the real value, please l
...
@@ -59,7 +59,7 @@ Replace <DSN\> with real TDengine cloud DSN. To obtain the real value, please l
Copy following code to
`main.rs`
.
Copy following code to
`main.rs`
.
```
rust title="main.rs"
```
rust title="main.rs"
{{#include docs/examples/rust/cloud
_
example/src/main.rs}}
{{#include docs/examples/rust/cloud
-
example/src/main.rs}}
```
```
Then you can execute
`cargo run`
to test the connection.
Then you can execute
`cargo run`
to test the connection.
\ No newline at end of file
docs/examples/rust/cloud
_
example/Cargo.toml
→
docs/examples/rust/cloud
-
example/Cargo.toml
浏览文件 @
6ba9ecb4
[package]
[package]
name
=
"cloud
_
example"
name
=
"cloud
-
example"
version
=
"0.1.0"
version
=
"0.1.0"
edition
=
"2021"
edition
=
"2021"
...
@@ -9,4 +9,4 @@ edition = "2021"
...
@@ -9,4 +9,4 @@ edition = "2021"
[dependencies]
[dependencies]
libtaos
=
{
version
=
"0.4.5-alpha.0"
,
features
=
["rest"]
}
libtaos
=
{
version
=
"0.4.5-alpha.0"
,
features
=
["rest"]
}
tokio
=
{
version
=
"1"
,
features
=
["full"]
}
tokio
=
{
version
=
"1"
,
features
=
["full"]
}
anyhow
=
"
*"
anyhow
=
"
1.0.0"
docs/examples/rust/cloud
_
example/src/main.rs
→
docs/examples/rust/cloud
-
example/src/main.rs
浏览文件 @
6ba9ecb4
...
@@ -3,7 +3,7 @@ use libtaos::*;
...
@@ -3,7 +3,7 @@ use libtaos::*;
#[tokio::main]
#[tokio::main]
async
fn
main
()
->
Result
<
()
>
{
async
fn
main
()
->
Result
<
()
>
{
let
dsn
=
std
::
env
::
var
(
"TDENGINE_CLOUD_DSN"
)
.unwrap
()
;
let
dsn
=
std
::
env
::
var
(
"TDENGINE_CLOUD_DSN"
)
?
;
let
cfg
=
TaosCfg
::
from_dsn
(
dsn
)
?
;
let
cfg
=
TaosCfg
::
from_dsn
(
dsn
)
?
;
let
conn
=
cfg
.connect
()
?
;
let
conn
=
cfg
.connect
()
?
;
let
_
=
conn
.query
(
"show databases"
)
.await
?
;
let
_
=
conn
.query
(
"show databases"
)
.await
?
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录