-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
111 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub mod abi; | ||
pub mod api; | ||
mod code; | ||
|
||
pub use self::code::{decode, encode}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use rocket::{ | ||
get, | ||
serde::{json::Json, Serialize}, | ||
}; | ||
|
||
#[derive(Serialize)] | ||
#[serde(crate = "rocket::serde")] | ||
pub struct Message<'a> { | ||
text: &'a str, | ||
} | ||
|
||
#[get("/")] | ||
pub async fn index() -> Json<Message<'static>> { | ||
let message = Message { text: "hello" }; | ||
message.into() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
mod args; | ||
mod event; | ||
mod listen; | ||
mod manage; | ||
|
||
use self::{args::Args, listen::listen, manage::manage}; | ||
use tokio::sync::mpsc; | ||
|
||
pub async fn run() { | ||
use clap::Parser; | ||
|
||
let args = Args::parse(); | ||
|
||
let (sender, receiver) = mpsc::channel(16); | ||
let listen = tokio::spawn(listen(args.address(), sender)); | ||
let manage = tokio::spawn(manage(receiver)); | ||
let _ = tokio::join!(listen, manage); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
mod args; | ||
mod event; | ||
mod listen; | ||
mod manage; | ||
|
||
use self::{args::Args, listen::listen, manage::manage}; | ||
use tokio::sync::mpsc; | ||
use server::run; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
use clap::Parser; | ||
|
||
let args = Args::parse(); | ||
|
||
let (sender, receiver) = mpsc::channel(16); | ||
let listen = tokio::spawn(listen(args.address(), sender)); | ||
let manage = tokio::spawn(manage(receiver)); | ||
let _ = tokio::join!(listen, manage); | ||
run().await; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters