-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Scattered-Systems/v0.1.34
V0.1.34
- Loading branch information
Showing
81 changed files
with
350 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# scsys-core | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.