Skip to content

aekvi/rust-service-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Service Library for Merrymake

⚠️ This is an unofficial fork of the Rust service library for Merrymake. ⚠️

It defines all the basic functions needed to work with Merrymake.

Getting Started

Add the following dependency to your Merrymake service:

merrymake-service-library = { git = "https://github.com/aekvi/rust-service-library.git", tag = "latest" }

Also, Merrymake requires the entry point app. You can specify your src/main.rs file as this entry point by adding the following to your Cargo.toml:

[[bin]]
name = "app"
path = "src/main.rs"

Usage

Here is the most basic example of how to use this library:

use merrymake_service_library::{merrymake_service, reply_str_to_origin, Envelope};
use std::str;

pub fn main() -> Result<(), String> {
    merrymake_service!(
        {
            actions: {
                "handleHello": handle_hello
            }
        }
    )
}

pub fn handle_hello(buffer: Vec<u8>, _envelope: Envelope) -> Result<(), String> {
    let payload = str::from_utf8(&buffer).unwrap();
    reply_str_to_origin(format!("Hello, {}!", payload).as_str()).unwrap();
    Ok(())
}

Tutorials and templates

For more information check out tutorials at merrymake.dev.

All templates are available through the CLI and on GitHub.

About

Unofficial fork of the Merrymake rust-service-library

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •