Skip to content

Commit

Permalink
add: new method to initialize IpcConnect (#322)
Browse files Browse the repository at this point in the history
* add: `new` method to iniliaze IpcConnect

* add pubsub trait bound

* fix: docs ci

* nits
  • Loading branch information
yash-atreya authored Mar 15, 2024
1 parent 6fada4c commit 410850b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/transport-ipc/src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ pub struct IpcConnect<T> {
inner: T,
}

impl<T> IpcConnect<T> {
/// Create a new IPC connection object for any type T that can be converted into
/// `IpcConnect<T>`.
pub const fn new(inner: T) -> Self
where
Self: alloy_pubsub::PubSubConnect,
{
Self { inner }
}
}

macro_rules! impl_connect {
($target:ty) => {
impl From<$target> for IpcConnect<$target> {
Expand Down

0 comments on commit 410850b

Please sign in to comment.