This commit is contained in:
2026-07-31 00:01:41 +02:00
parent fb4d22c5a2
commit ccac73c3c5
7 changed files with 19 additions and 9 deletions
+11 -1
View File
@@ -5,13 +5,14 @@ pub use hypersdk;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use crate::strategy::StrategyEngineMessage;
use crate::{general::LogKind, strategy::StrategyEngineMessage};
pub mod prelude {
pub use crate::general::*;
pub use crate::server_path;
pub use crate::strategy::*;
pub use crate::terminal::*;
pub use crate::Strategy;
pub use hypersdk;
pub use postcard;
@@ -63,6 +64,15 @@ pub trait Strategy {
send_raw(&map_postcard_err(prelude::postcard::to_allocvec(msg))?).await
}
async fn log(&self, kind: LogKind, name: &str, message: &str) -> tokio::io::Result<()> {
self.send(&prelude::StrategyMessage::Log(prelude::EventLog {
kind,
name: name.to_owned(),
message: message.to_owned(),
}))
.await
}
async fn on_raw(&self, data: &[u8]) -> tokio::io::Result<()> {
match map_postcard_err(postcard::from_bytes(&data))? {
StrategyEngineMessage::Initialize => self.initialize().await,