Skip to content

Commit

Permalink
remove a dead trait
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-casper committed Oct 2, 2024
1 parent 6285c4d commit 0b5a0f3
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions node/src/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,33 +402,6 @@ pub(crate) trait EffectResultExt {
U: 'static;
}

/// Effect extension for futures, used to convert futures returning an `Option` into two different
/// effects.
#[allow(dead_code)]
pub(crate) trait EffectOptionExt {
/// The type the future will return if `Some`.
type Value;

/// Finalizes a future returning an `Option` into two different effects.
///
/// The function `f_some` is used to translate the returned value from an effect into an event,
/// while the function `f_none` does the same for a returned `None`.
fn map_or_else<U, F, G>(self, f_some: F, f_none: G) -> Effects<U>
where
F: FnOnce(Self::Value) -> U + 'static + Send,
G: FnOnce() -> U + 'static + Send,
U: 'static;

/// Finalizes a future returning an `Option` into two different effects.
///
/// The function `f` is used to translate the returned value from an effect into an event,
/// In the case of `None`, empty vector of effects is returned.
fn map_some<U, F>(self, f: F) -> Effects<U>
where
F: FnOnce(Self::Value) -> U + 'static + Send,
U: 'static;
}

impl<T: ?Sized> EffectExt for T
where
T: Future + Send + 'static + Sized,
Expand Down Expand Up @@ -467,42 +440,6 @@ where
}
}

impl<T, V> EffectOptionExt for T
where
T: Future<Output = Option<V>> + Send + 'static + Sized,
T: ?Sized,
{
type Value = V;

fn map_or_else<U, F, G>(self, f_some: F, f_none: G) -> Effects<U>
where
F: FnOnce(V) -> U + 'static + Send,
G: FnOnce() -> U + 'static + Send,
U: 'static,
{
smallvec![self
.map(|option| option.map_or_else(f_none, f_some))
.map(|item| smallvec![item])
.boxed()]
}

/// Finalizes a future returning an `Option`.
///
/// The function `f` is used to translate the returned value from an effect into an event,
/// In the case of `None`, empty vector is returned.
fn map_some<U, F>(self, f: F) -> Effects<U>
where
F: FnOnce(Self::Value) -> U + 'static + Send,
U: 'static,
{
smallvec![self
.map(|option| option
.map(|el| smallvec![f(el)])
.unwrap_or_else(|| smallvec![]))
.boxed()]
}
}

/// A builder for [`Effect`](type.Effect.html)s.
///
/// Provides methods allowing the creation of effects which need to be scheduled on the reactor's
Expand Down

0 comments on commit 0b5a0f3

Please sign in to comment.