提交 6ba9ecb4 编写于 作者: D dingbo

docs: rust

上级 70504d88
......@@ -9,14 +9,14 @@ import TabItem from '@theme/TabItem';
## Create Project
```
cargo new cloud_example
cargo new --bin cloud-example
```
## Add Dependency
Add dependency to `Cargo.toml`.
```toml title="Cargo.toml"
{{#include docs/examples/rust/cloud_example/Cargo.toml}}
{{#include docs/examples/rust/cloud-example/Cargo.toml}}
```
## Config
......@@ -59,7 +59,7 @@ Replace <DSN\> with real TDengine cloud DSN. To obtain the real value, please l
Copy following code to `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.
\ No newline at end of file
[package]
name = "cloud_example"
name = "cloud-example"
version = "0.1.0"
edition = "2021"
......@@ -9,4 +9,4 @@ edition = "2021"
[dependencies]
libtaos = { version="0.4.5-alpha.0", features=["rest"]}
tokio = { version = "1", features = ["full"]}
anyhow = "*"
anyhow = "1.0.0"
......@@ -3,7 +3,7 @@ use libtaos::*;
#[tokio::main]
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 conn = cfg.connect()?;
let _ = conn.query("show databases").await?;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册