Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release 0.0.7 #28

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading