From: Ian Jackson Date: Thu, 13 Aug 2020 00:02:05 +0000 (+0100) Subject: wip client X-Git-Tag: otter-0.2.0~1139 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=51ea474f3829a6e4d380ad93bcd2109832016a4f;p=otter.git wip client --- diff --git a/src/client.rs b/src/client.rs new file mode 100644 index 00000000..a1124a52 --- /dev/null +++ b/src/client.rs @@ -0,0 +1,14 @@ + +use crate::imports::*; + +pub struct MgmtConnection { + read : io::Lines>, + write : BufWriter, +} + +impl MgmtConnection { + fn connect() { + todo!(); +// let mut both = UnixStream:;connect(SOCKET_PATH)?; + } +} diff --git a/src/imports.rs b/src/imports.rs index 5a2047d7..bb48b0ec 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -72,6 +72,7 @@ pub use crate::commands::*; pub use crate::slotmap_slot_idx::*; pub use crate::cmdlistener::*; pub use crate::spec::*; +pub use crate::client::*; pub use crate::api::{Lens,TransparentLens}; pub use crate::utils::OrdExt; diff --git a/src/lib.rs b/src/lib.rs index 8636c34f..638c57dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,4 +19,5 @@ pub mod spec; pub mod cmdlistener; pub mod commands; pub mod utils; +pub mod client; #[path="slotmap-slot-idx.rs"] pub mod slotmap_slot_idx; diff --git a/src/spec.rs b/src/spec.rs index 3aaa5165..d11b4dc3 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -12,7 +12,7 @@ pub struct TableSpec { pub struct PlayerSpec { pub nick: String, #[serde(flatten)] - pub access: Box, + pub access: Option>, } #[derive(Debug,Serialize,Deserialize)] @@ -33,7 +33,17 @@ pub struct PiecesSpec { #[typetag::serde(tag="access")] pub trait PlayerAccessSpec : Debug { - #[throws(OE)] - /// todo const DELIVER_TOKEN_SERVER : bool; etc. - fn deliver_token(&mut self) -> Result<(),OE>; + fn deliver_token_client(&self, conn: &mut MgmtConnection, nick: &str) + -> Result<(),anyhow::Error>; +} + +#[derive(Debug,Serialize,Deserialize)] +struct UrlOnStdout; + +#[typetag::serde] +impl PlayerAccessSpec for UrlOnStdout { + fn deliver_token_client(&self, conn: &mut MgmtConnection, nick: &str) + -> Result<(),anyhow::Error> { + todo!() + } }