Skip to content

Release v0.5.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@jjeffcaii jjeffcaii released this 26 May 15:07
· 59 commits to master since this release
7677730

New features: RSocket Messaging 🌟

Example:

#[macro_use]
extern crate serde_derive;

use rsocket_rust_messaging::Requester;

#[derive(Serialize, Deserialize, Debug)]
pub struct Student {
    id: i64,
    name: String,
    gender: u8,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Classroom {
    id: u32,
    name: String,
}

#[tokio::main]
async fn main() {
    let requester = Requester::builder()
        .connect_tcp("127.0.0.1", 7878)
        .build()
        .await
        .expect("Connect failed!");
    // Query all students of some classroom
    let res: Vec<Student> = requester
        .route("students.v1")
        .data(Classroom {
            id: 1,
            name: "some classroom".to_owned(),
        })
        .retrieve_flux()
        .block()
        .await
        .expect("Retrieve failed!");
    for it in res.iter() {
        info!("===> NEXT: {:?}", it);
    }
}