Skip to content

Commit

Permalink
Merge pull request #30 from Scattered-Systems/v0.1.34
Browse files Browse the repository at this point in the history
V0.1.34
  • Loading branch information
FL03 authored Nov 29, 2022
2 parents aa8b9a9 + c77eaad commit 7d3ff38
Show file tree
Hide file tree
Showing 81 changed files with 350 additions and 243 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
schedule:
interval: daily
- package-ecosystem: cargo
directory: /agents
directory: /actors
schedule:
interval: daily
- package-ecosystem: cargo
Expand Down
32 changes: 32 additions & 0 deletions actors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
authors = ["FL03 <jo3mccain@icloud.com> (https://github.com/FL03)", "Scattered-Systems (https://github.com/scattered-systems)"]
categories = []
description = "scsys-actors"
edition = "2021"
homepage = "https://github.com/scattered-systems/scsys/wiki"
keywords = ["core", "primitives", "scsys"]
license = "Apache-2.0"
name = "scsys-actors"
repository = "https://github.com/scattered-systems/scsys"
version = "0.1.34" # TODO: Update the package version

[lib]
crate-type = ["cdylib", "rlib"]
test = true

[dev-dependencies]
scsys-core = { path = "../core" }

[dependencies]
bson = { features = ["chrono-0_4", "serde_with", "uuid-0_8"], version = "2.4.0" }
chrono = "0.4.22"
config = "0.13.2"
glob = "0.3.0"
nom = "7.1.1"
serde = { features = ["derive"], version = "1.0.147" }
serde_json = "1.0.87"
strum = { features = ["derive"], version = "0.24.1" }
url = "2.3.1"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions actors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# scsys-core

56 changes: 56 additions & 0 deletions actors/src/agents/agent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Appellation: agent <agents>
Creator: FL03 <jo3mccain@icloud.com>
Description: ... Summary ...
*/
use super::Agency;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Agent<T>(T);

impl<T> Agent<T> {
pub fn new(data: T) -> Self {
Self(data)
}
}

impl<T: Clone + Default + Serialize + ToString> Agency for Agent<T> {
fn init() -> Self {
Self::new(Default::default())
}
fn agent(&self) -> String {
self.to_string()
}
}

impl<T: Clone> std::convert::From<&Agent<T>> for Agent<T> {
fn from(data: &Agent<T>) -> Self {
data.clone()
}
}

impl<T: Serialize> std::fmt::Debug for Agent<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string_pretty(&self).unwrap())
}
}

impl<T: Serialize> std::fmt::Display for Agent<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string(&self).unwrap())
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_default_agent() {
let a = Agent::<String>::default();
let b = Agent::from(&a);

assert_eq!(&a, &b)
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions actors/src/contexts/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Appellation: contexts <module>
Creator: FL03 <jo3mccain@icloud.com>
Description:
... Summary ...
*/
pub use self::{context::*, specs::*};

pub(crate) mod context;

pub(crate) mod specs {
use serde::Serialize;

pub trait Configurable: Serialize {
type Settings;

fn settings(&self) -> &Self::Settings;
}

pub trait Contextual: ToString {
type Cnf: Configurable;
type Ctx;

fn context(&self) -> &Self::Ctx;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct FileHandler {
pub path: String,
}
pub struct Handler;

impl FileHandler {
pub fn new(path: String) -> Self {
Self { path }
impl Handler {
pub fn new() -> Self {
Self
}
}

pub trait DocumentHandler {
fn path(&self) -> String;
}
19 changes: 19 additions & 0 deletions actors/src/handlers/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Appellation: handlers <module>
Creator: FL03 <jo3mccain@icloud.com>
Description:
... Summary ...
*/
pub use self::{handler::*, specs::*, utils::*};

pub(crate) mod handler;

pub(crate) mod specs {
use crate::states::Stateful;

pub trait StateHandle<S: Stateful> {
fn state(&self) -> &S;
}
}

pub(crate) mod utils {}
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions actors/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Appellation: scsys-core <library>
Creator: FL03 <jo3mccain@icloud.com>
Description:
... Summary ...
*/

pub mod agents;
pub mod catalysts;
pub mod contexts;
pub mod handlers;
pub mod justify;
pub mod messages;
pub mod states;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions actors/tests/default.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[cfg(test)]
mod tests {
#[test]
fn lib_compiles() {
let f = |i: usize| i + 1;
assert_eq!(f(10), 11);
assert_ne!(f(10), 9)
}
}
6 changes: 3 additions & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords = ["core", "primitives", "scsys"]
license = "Apache-2.0"
name = "scsys-core"
repository = "https://github.com/scattered-systems/scsys"
version = "0.1.33" # TODO: Update the package version
version = "0.1.34" # TODO: Update the package version

[lib]
crate-type = ["cdylib", "rlib"]
Expand All @@ -20,8 +20,8 @@ chrono = "0.4.22"
config = "0.13.2"
glob = "0.3.0"
nom = "7.1.1"
serde = { features = ["derive"], version = "1.0.147" }
serde_json = "1.0.87"
serde = { features = ["derive"], version = "1.0.148" }
serde_json = "1.0.89"
strum = { features = ["derive"], version = "0.24.1" }
url = "2.3.1"

Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions core/src/actors/handlers/mod.rs

This file was deleted.

11 changes: 0 additions & 11 deletions core/src/actors/mod.rs

This file was deleted.

37 changes: 0 additions & 37 deletions core/src/components/agents/agent.rs

This file was deleted.

13 changes: 0 additions & 13 deletions core/src/components/mod.rs

This file was deleted.

10 changes: 0 additions & 10 deletions core/src/core/contexts/mod.rs

This file was deleted.

13 changes: 0 additions & 13 deletions core/src/core/contexts/specs/configurable.rs

This file was deleted.

14 changes: 0 additions & 14 deletions core/src/core/contexts/specs/contextual.rs

This file was deleted.

10 changes: 0 additions & 10 deletions core/src/core/contexts/specs/mod.rs

This file was deleted.

14 changes: 0 additions & 14 deletions core/src/core/mod.rs

This file was deleted.

31 changes: 0 additions & 31 deletions core/src/core/utils/times.rs

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 7d3ff38

Please sign in to comment.