From 6334a0f4964f9c58b00d03030f68d8283128a33f Mon Sep 17 00:00:00 2001 From: Cameron Bytheway Date: Thu, 21 Nov 2024 21:23:10 -0700 Subject: [PATCH] chore: release 0.0.7 --- bach/Cargo.toml | 2 +- bach/src/net.rs | 2 +- bach/src/sync/queue.rs | 47 +++++++++++++++++++++++++++++++++++++++++- bach/src/tracing.rs | 1 - 4 files changed, 48 insertions(+), 4 deletions(-) delete mode 100644 bach/src/tracing.rs diff --git a/bach/Cargo.toml b/bach/Cargo.toml index 245e2d4..6c96b6f 100644 --- a/bach/Cargo.toml +++ b/bach/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bach" -version = "0.0.6" +version = "0.0.7" authors = ["Cameron Bytheway "] description = "Discrete-event simulation environment for async workflows" repository = "https://github.com/camshaft/bach" diff --git a/bach/src/net.rs b/bach/src/net.rs index 25212c3..f607d3e 100644 --- a/bach/src/net.rs +++ b/bach/src/net.rs @@ -1 +1 @@ -pub use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6}; +pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; diff --git a/bach/src/sync/queue.rs b/bach/src/sync/queue.rs index 8227ece..db5f2aa 100644 --- a/bach/src/sync/queue.rs +++ b/bach/src/sync/queue.rs @@ -1,6 +1,6 @@ use crate::{sync::channel, time::Instant}; use core::fmt; -use std::task::Context; +use std::{sync::Arc, task::Context}; pub mod latent; pub mod priority; @@ -23,6 +23,51 @@ pub trait Queue { fn capacity(&self) -> Option; } +impl Queue for Arc +where + Q: Queue, +{ + fn push(&self, value: T) -> Result, PushError> { + self.as_ref().push(value) + } + + fn push_with_context(&self, value: T, cx: &mut Context) -> Result, PushError> { + self.as_ref().push_with_context(value, cx) + } + + fn pop(&self) -> Result { + self.as_ref().pop() + } + + fn pop_with_context(&self, cx: &mut Context) -> Result { + self.as_ref().pop_with_context(cx) + } + + fn close(&self) -> Result<(), CloseError> { + self.as_ref().close() + } + + fn is_closed(&self) -> bool { + self.as_ref().is_closed() + } + + fn is_empty(&self) -> bool { + self.as_ref().is_empty() + } + + fn is_full(&self) -> bool { + self.as_ref().is_full() + } + + fn len(&self) -> usize { + self.as_ref().len() + } + + fn capacity(&self) -> Option { + self.as_ref().capacity() + } +} + pub trait Conditional: Queue { fn find_pop bool>(&self, check: F) -> Result; } diff --git a/bach/src/tracing.rs b/bach/src/tracing.rs deleted file mode 100644 index d2e9227..0000000 --- a/bach/src/tracing.rs +++ /dev/null @@ -1 +0,0 @@ -pub use tracing::*;