Build Status

ice-rs

The goal of this project is to support Rust in ZeroC Ice.

Quick Start

This quick start guide will cover a client for the ZeroC Ice Minimal Sample. Create a binary application with cargo new minimal-client and add ice-rs to your [build-dependencies]and [dependencies]. Now add a build.rs file with the following content:

Minimal client

```Rust use ice_rs::slice::parser; use std::path::Path;

fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=build.rs"); let icefiles = vec![ String::from("") ]; let rootmodule = parser::parseicefiles(&icefiles, "")?; rootmodule.generate(Path::new("./src/gen"), "") } ```

Now add the following to you main.rs: ```Rust use ice_rs::communicator::Communicator;

mod gen; use crate::gen::demo::{Hello,HelloPrx};

[tokio::main]

async fn main() -> Result<(), Box> { let mut comm = Communicator::new().await?; let proxy = comm.stringtoproxy("hello:default -h localhost -p 10000").await?; let mut helloprx = HelloPrx::checkedcast(proxy).await?;

hello_prx.say_hello(None).await

} ```

Minimal server

Based on the same build.rs file you can add a server for the minimal example.

```Rust use icers::communicator::Communicator; use std::collections::HashMap; use asynctrait::async_trait;

mod gen; use crate::gen::demo::{HelloServer, HelloI};

struct HelloImpl {}

[async_trait]

impl HelloI for HelloImpl { async fn say_hello(&mut self, _context: Option>) -> () { println!("Hello World!"); () } }

[tokio::main]

async fn main() -> Result<(), Box> { let comm = Communicator::new().await?; let mut adapter = comm.createobjectadapterwithendpoint("hello", "tcp -h localhost -p 10000").await?;

let hello_server = HelloServer::new(Box::new(HelloImpl{}));

adapter.add("hello", Box::new(hello_server));
adapter.activate().await?;

Ok(())

} ```

Status

The status can be seen in the number of supported ZeroC Ice Demos.

Supported transports: - TCP - SSL

Roadmap

The main goal is to support all ZeroC Ice Demos.