Cycled buffer for storing ping times

This commit is contained in:
Andrew Golovashevich 2026-03-10 19:07:33 +03:00
parent adcb73594d
commit a61c5332a0
6 changed files with 24 additions and 12 deletions

View File

@ -6,7 +6,8 @@ members = [
"network/abstract",
"network/windows",
"gui/abstract",
"gui/egui"
"gui/egui",
"data"
]
[workspace.lints]

View File

@ -1,2 +0,0 @@
mod cycle_buffer;
mod server;

View File

@ -1,8 +0,0 @@
use crate::io::Address;
use crate::data::cycle_buffer::CycledBuffer;
pub struct Server {
address: Address,
history: CycledBuffer<u16>,
label: String,
}

11
data/Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "bgtu-networks-2-data"
version = "0.0.0"
edition = "2024"
[lints]
workspace = true
[dependencies]
bgtu-networks-2-network-abstract = { path = "../network/abstract" }
bgtu-networks-2-gui-abstract = { path = "../gui/abstract" }

View File

@ -183,7 +183,7 @@ impl<C: Len, E, G: Fn(&mut C, usize) -> E> Iterator for CycledIterator<C, E, G>
#[cfg(test)]
mod _tests {
use crate::data::cycle_buffer::CycledBuffer;
use super::CycledBuffer;
#[test]
fn test1() {

10
data/src/lib.rs Normal file
View File

@ -0,0 +1,10 @@
mod cycle_buffer;
use std::collections::HashSet;
use bgtu_networks_2_gui_abstract::ServersStorage as ServersGuiCtx;
use bgtu_networks_2_network_abstract::{Address, ServersContext as ServersNetworkCtx};
use crate::cycle_buffer::CycledBuffer;
struct ServersStorage<A: Address> {
map: HashSet<A, (String, CycledBuffer<Option<u32>>)>
}