Split out binary from library
This commit is contained in:
parent
d05dd10c14
commit
87bcaacaa4
|
@ -4,6 +4,9 @@ version = "0.1.0"
|
||||||
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "syndicate"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
preserves = "0.3.1"
|
preserves = "0.3.1"
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,8 @@
|
||||||
#![recursion_limit="512"]
|
use syndicate::{peer, spaces};
|
||||||
|
|
||||||
mod bag;
|
|
||||||
mod dataspace;
|
|
||||||
mod packets;
|
|
||||||
mod peer;
|
|
||||||
mod skeleton;
|
|
||||||
mod spaces;
|
|
||||||
|
|
||||||
use preserves::value;
|
|
||||||
use std::sync::{Mutex, Arc};
|
use std::sync::{Mutex, Arc};
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
|
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
||||||
pub enum Syndicate {
|
|
||||||
Placeholder(usize),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl value::Domain for Syndicate {}
|
|
||||||
|
|
||||||
static NEXT_PLACEHOLDER: AtomicUsize = AtomicUsize::new(0);
|
|
||||||
impl Syndicate {
|
|
||||||
pub fn new_placeholder() -> Self {
|
|
||||||
Self::Placeholder(NEXT_PLACEHOLDER.fetch_add(1, Ordering::SeqCst))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type ConnId = u64;
|
|
||||||
pub type V = value::ArcValue<Syndicate>;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let spaces = Arc::new(Mutex::new(spaces::Spaces::new()));
|
let spaces = Arc::new(Mutex::new(spaces::Spaces::new()));
|
|
@ -0,0 +1,29 @@
|
||||||
|
#![recursion_limit="512"]
|
||||||
|
|
||||||
|
pub mod bag;
|
||||||
|
pub mod dataspace;
|
||||||
|
pub mod packets;
|
||||||
|
pub mod peer;
|
||||||
|
pub mod skeleton;
|
||||||
|
pub mod spaces;
|
||||||
|
|
||||||
|
pub use preserves::value;
|
||||||
|
|
||||||
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub enum Syndicate {
|
||||||
|
Placeholder(usize),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl value::Domain for Syndicate {}
|
||||||
|
|
||||||
|
static NEXT_PLACEHOLDER: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
impl Syndicate {
|
||||||
|
pub fn new_placeholder() -> Self {
|
||||||
|
Self::Placeholder(NEXT_PLACEHOLDER.fetch_add(1, Ordering::SeqCst))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ConnId = u64;
|
||||||
|
pub type V = value::ArcValue<Syndicate>;
|
Loading…
Reference in New Issue