Name refactor

This commit is contained in:
2026-07-22 18:30:16 +02:00
parent 39735bad87
commit a641de074f
5 changed files with 30 additions and 30 deletions
+4 -4
View File
@@ -1,11 +1,11 @@
pub mod terminal;
pub trait PulseCom {
pub trait PulseWire {
fn to_com(&self) -> Vec<u8>;
fn from_com(_com: &mut Vec<u8>) -> Self;
}
impl<T: PulseCom> PulseCom for Vec<T> {
impl<T: PulseWire> PulseWire for Vec<T> {
fn to_com(&self) -> Vec<u8> {
let mut vec = Vec::new();
@@ -33,7 +33,7 @@ impl<T: PulseCom> PulseCom for Vec<T> {
}
}
impl PulseCom for String {
impl PulseWire for String {
fn to_com(&self) -> Vec<u8> {
let bytes = self.as_bytes();
let mut out = Vec::with_capacity(4 + bytes.len());
@@ -55,7 +55,7 @@ impl PulseCom for String {
macro_rules! int_com {
($t:ty) => {
impl PulseCom for $t {
impl $crate::PulseWire for $t {
fn to_com(&self) -> Vec<u8> {
self.to_le_bytes().to_vec()
}
+17 -17
View File
@@ -1,35 +1,35 @@
use crate::PulseCom;
use pulse_macros::p_com;
use crate::PulseWire;
use pulse_macros::pwp;
#[p_com]
#[pwp]
pub struct WatchListItem {
symbol: String,
price: f64,
trend: f64,
}
#[p_com]
#[pwp]
pub struct ActivePosition {
symbol: String,
profit: f64,
amount: f64,
}
#[p_com]
#[pwp]
pub enum MarketTrend {
Bullish,
Bearish,
Neutral,
}
#[p_com]
#[pwp]
pub enum Volatility {
Low,
Medium,
High,
}
#[p_com]
#[pwp]
pub struct MarketOverview {
trend: MarketTrend,
volatility: Volatility,
@@ -38,7 +38,7 @@ pub struct MarketOverview {
alerts: Vec<Alert>,
}
#[p_com]
#[pwp]
pub enum Feed {
Connected,
Disconnected,
@@ -46,7 +46,7 @@ pub enum Feed {
Failed,
}
#[p_com]
#[pwp]
pub struct Status {
feed: Feed,
exchange: String,
@@ -54,13 +54,13 @@ pub struct Status {
latency: u16,
}
#[p_com]
#[pwp]
pub enum SignalKind {
Buy,
Sell,
}
#[p_com]
#[pwp]
pub enum SignalParameter {
Lim,
Stl,
@@ -68,7 +68,7 @@ pub enum SignalParameter {
Chk,
}
#[p_com]
#[pwp]
pub struct Signal {
kind: SignalKind,
symbol: String,
@@ -76,7 +76,7 @@ pub struct Signal {
price: f64,
}
#[p_com]
#[pwp]
pub enum LogKind {
Info,
Warn,
@@ -84,27 +84,27 @@ pub enum LogKind {
Debug,
}
#[p_com]
#[pwp]
pub struct EventLog {
kind: LogKind,
name: String,
message: String,
}
#[p_com]
#[pwp]
pub enum AlertLevel {
High,
Medium,
Low,
}
#[p_com]
#[pwp]
pub struct Alert {
level: AlertLevel,
message: String,
}
#[p_com]
#[pwp]
pub enum InspectTarget {
None,
Symbol(WatchListItem),