Skip to content

Commit

Permalink
Update backend/rust/bunker/src/lib.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Luca Barbato <[email protected]>
Signed-off-by: Aisuko <[email protected]>
  • Loading branch information
Aisuko and lu-zero authored Oct 19, 2023
1 parent 61bd269 commit b92677b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion backend/rust/bunker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@ pub mod pb {
include!("../generated/backend.rs");
}

pub mod service;
use tonic::transport::Server;

pub use crate::pb::backend_server::Backend as BackendService;
use crate::pb::backend_server::BackendServer;

// Run the backend with the default behavior
pub async fn run(backend: impl BackendService, addr: impl Into<SocketAddr>) -> anyhow::Result<()> {
let svc = BackendServer::new(backend);

let r = Server::builder()
.add_service(svc)
.serve(addr.into())
.await?;

Ok(r)

0 comments on commit b92677b

Please sign in to comment.