Skip to content

Commit

Permalink
removed code from readme
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-cavalcanti committed Sep 15, 2023
1 parent a0b81fe commit 610a64e
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,34 +72,7 @@ add this crate at your cargo.toml :

```toml
# the branch is the coppelia version
zmq_remote_api = { git = "https://github.com/samuel-cavalcanti/rust_zmqRemoteApi", branch = "CoppeliaSim_4.4.0"}
zmq_remote_api = { git = "https://github.com/samuel-cavalcanti/rust_zmqRemoteApi", branch = "CoppeliaSim_4.5.1"}
```

See this simple [example](examples/get_simulation_time.rs) to understand how to use this create.

### Main Branch

the main branch use the smart pointers
```rust
// main branch
let client = zmq_remote_api::RemoteApiClient::new(RemoteApiClientParams {
host: "localhost".to_string(),
..RemoteApiClientParams::default()
})?;

// Rc means Reference counter, is a smart pointer that counter the number of references
let client = Rc::new(client);
let sim = Sim::new(client.clone());
```
Using smart pointer is easier than dealing with borrowing and life cycle.

```rust
// CoppeliaSim_4.4.0, CoppeliaSim_4.3.0

let client = zmq_remote_api::RemoteApiClient::new(RemoteApiClientParams {
host: "localhost".to_string(),
..RemoteApiClientParams::default()
})?;

let sim = Sim::new(&client);
```

0 comments on commit 610a64e

Please sign in to comment.