fix: 以 $crate:: 导出宏 Signed-off-by: YdrMaster ydrml@hotmail.com
fix: 以 $crate:: 导出宏
$crate::
Signed-off-by: YdrMaster ydrml@hotmail.com
# monitor-tool-rs
使用纯 Rust 实现的跨平台二维数据可视化工具(视频示例)。
渲染基于 iced。
最新版编译器编译的不能收包,需要 debug。
产生数据的应用程序向工具启动时指定的固定端口发送 UDP 包即可实时绘图。
项目包含一个 [[bin]] 目标用于启动应用程序。
[[bin]]
不带参数默认以标题 Figure1 和端口 12345 启动。
Figure1
12345
cargo run --release
也可以传入指定的标题和端口。
cargo run --release -- 图2 23333
数据源项目在 Cargo.toml 中依赖此项目。
Cargo.toml
monitor-tool = { path = "../monitor-tool-rs", default-features = false, features = [ "client", ] }
调用编码器编码图形并发送(示例在此文件)。
const TOPIC: &str = "test"; let socket = UdpSocket::bind("0.0.0.0:0").unwrap(); let _ = socket.connect("127.0.0.1:12345"); { let mut rng = thread_rng(); let mut colors = Vec::with_capacity(256); for i in 0..255 { colors.push((i, rng.gen::<Srgba>())); } let _ = socket.send(&Encoder::with(|encoder| { encoder.config_topic(TOPIC, 200000, 200, &colors, |_| {}); })); } for i in 0u64.. { let mut encoder = Encoder::default(); let mut topic = encoder.topic(TOPIC); for j in 0..500 { let theta = ((i * 500 + j) as f32).powf(1.1) * PI * 1e-2; let (sin, cos) = theta.sin_cos(); topic.push(vertex!((i ^ j) as u8; 0.1 * theta * cos, 0.1 * theta * sin; 255)); } let _ = socket.send(&encoder.encode()); thread::sleep(Duration::from_millis(200)); }
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
# monitor-tool-rs
使用纯 Rust 实现的跨平台二维数据可视化工具(视频示例)。
渲染基于 iced。
使用说明
显示
产生数据的应用程序向工具启动时指定的固定端口发送 UDP 包即可实时绘图。
项目包含一个
[[bin]]
目标用于启动应用程序。不带参数默认以标题
Figure1
和端口12345
启动。也可以传入指定的标题和端口。
交互操作
发送
数据源项目在
Cargo.toml
中依赖此项目。调用编码器编码图形并发送(示例在此文件)。