Skip to content

Commit

Permalink
ItemExt renamed FirstExt
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-kolarik committed Sep 2, 2023
1 parent 52ed8c3 commit 5ae63ee
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/futures_signals_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,33 +247,33 @@ impl<A> MutableVecExt<A> for MutableVec<A> {
}
}

pub trait SignalVecItemExt<A> {
fn item(self) -> impl Signal<Item = Option<A>>
pub trait SignalVecFirstExt<A> {
fn first(self) -> impl Signal<Item = Option<A>>
where
A: Copy,
Self: Sized,
{
self.item_map(|i| *i)
self.first_map(|i| *i)
}

fn item_cloned(self) -> impl Signal<Item = Option<A>>
fn first_cloned(self) -> impl Signal<Item = Option<A>>
where
A: Clone,
Self: Sized,
{
self.item_map(|i| i.clone())
self.first_map(|i| i.clone())
}

fn item_map<F, U>(self, f: F) -> impl Signal<Item = Option<U>>
fn first_map<F, U>(self, f: F) -> impl Signal<Item = Option<U>>
where
F: FnMut(&A) -> U;
}

impl<A, S> SignalVecItemExt<A> for S
impl<A, S> SignalVecFirstExt<A> for S
where
S: SignalVec<Item = A>,
{
fn item_map<F, U>(self, mut f: F) -> impl Signal<Item = Option<U>>
fn first_map<F, U>(self, mut f: F) -> impl Signal<Item = Option<U>>
where
F: FnMut(&A) -> U,
{
Expand Down

0 comments on commit 5ae63ee

Please sign in to comment.