Skip to content

Commit

Permalink
chore: release 0.0.7 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Nov 22, 2024
1 parent 2ce5e6b commit 863b643
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bach/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bach"
version = "0.0.6"
version = "0.0.7"
authors = ["Cameron Bytheway <[email protected]>"]
description = "Discrete-event simulation environment for async workflows"
repository = "https://github.com/camshaft/bach"
Expand Down
2 changes: 1 addition & 1 deletion bach/src/net.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6};
pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
47 changes: 46 additions & 1 deletion bach/src/sync/queue.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -23,6 +23,51 @@ pub trait Queue<T> {
fn capacity(&self) -> Option<usize>;
}

impl<T, Q> Queue<T> for Arc<Q>
where
Q: Queue<T>,
{
fn push(&self, value: T) -> Result<Option<T>, PushError<T>> {
self.as_ref().push(value)
}

fn push_with_context(&self, value: T, cx: &mut Context) -> Result<Option<T>, PushError<T>> {
self.as_ref().push_with_context(value, cx)
}

fn pop(&self) -> Result<T, PopError> {
self.as_ref().pop()
}

fn pop_with_context(&self, cx: &mut Context) -> Result<T, PopError> {
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<usize> {
self.as_ref().capacity()
}
}

pub trait Conditional<T>: Queue<T> {
fn find_pop<F: Fn(&T) -> bool>(&self, check: F) -> Result<T, PopError>;
}
Expand Down
1 change: 0 additions & 1 deletion bach/src/tracing.rs

This file was deleted.

0 comments on commit 863b643

Please sign in to comment.