From f6f0f1408188b86712f765a671756d512be7acce Mon Sep 17 00:00:00 2001 From: Gregor Reitzenstein Date: Tue, 28 Apr 2020 18:40:50 +0200 Subject: [PATCH] Make compile --- src/access.rs | 7 ------- src/api.rs | 4 +--- src/machine.rs | 10 ++-------- src/main.rs | 2 +- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/access.rs b/src/access.rs index a71a0a4..58196aa 100644 --- a/src/access.rs +++ b/src/access.rs @@ -5,9 +5,6 @@ use slog::Logger; use casbin::prelude::*; -use futures_signals::signal::Mutable; - -use crate::api::api; use crate::config::Config; use crate::auth::Authentication; use crate::error::Result; @@ -58,10 +55,6 @@ impl Permissions { } } -impl api::permissions::Server for Permissions { - -} - /// This line documents init pub async fn init(log: Logger, config: &Config) -> std::result::Result> { let model = Model::from_file(config.access.model.clone()).await?; diff --git a/src/api.rs b/src/api.rs index 1a4c133..ba37aae 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1,6 +1,6 @@ // module needs to be top level for generated functions to be in scope: // https://github.com/capnproto/capnproto-rust/issues/16 -pub mod api { +pub mod gen { include!(concat!(env!("OUT_DIR"), "/schema/api_capnp.rs")); } @@ -30,8 +30,6 @@ use capnp_rpc::rpc_twoparty_capnp::Side; use std::ops::Deref; -use api::diflouroborane; - pub async fn handle_connection(log: Logger, socket: TcpStream) -> Result<(), Error> { unimplemented!() } diff --git a/src/machine.rs b/src/machine.rs index ec61f26..e45770e 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -8,22 +8,16 @@ use slog::Logger; use serde::{Serialize, Deserialize}; use toml; -use futures_signals::signal::Mutable; - use crate::error::Result; use crate::config::Config; -use crate::api::api; use crate::access::Permissions; use std::rc::Rc; use async_std::sync::{Arc, RwLock}; -use capnp::capability::Promise; use capnp::Error; -use capnp_rpc::Server; use uuid::Uuid; -use std::ops::DerefMut; /// Status of a Machine #[derive(PartialEq, Eq, Debug, Serialize, Deserialize)] @@ -115,13 +109,13 @@ impl GiveBack { } } -fn uuid_from_api(uuid: api::u_u_i_d::Reader) -> Uuid { +fn uuid_from_api(uuid: crate::api_capnp::u_u_i_d::Reader) -> Uuid { let uuid0 = uuid.get_uuid0() as u128; let uuid1 = uuid.get_uuid1() as u128; let num: u128 = (uuid1 << 64) + uuid0; Uuid::from_u128(num) } -fn api_from_uuid(uuid: Uuid, mut wr: api::u_u_i_d::Builder) { +fn api_from_uuid(uuid: Uuid, mut wr: crate::api_capnp::u_u_i_d::Builder) { let num = uuid.to_u128_le(); let uuid0 = num as u64; let uuid1 = (num >> 64) as u64; diff --git a/src/main.rs b/src/main.rs index 820302f..f7c766a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ use signal_hook::iterator::Signals; use clap::{App, Arg}; -use api::api as api_capnp; +use api::gen as api_capnp; use futures::prelude::*; use futures::executor::{LocalPool, ThreadPool};