mirror of
https://github.com/Noratrieb/ice-104649.git
synced 2026-01-14 20:45:01 +01:00
lol no futures
This commit is contained in:
parent
fe78f016cb
commit
89355810f4
1 changed files with 15 additions and 15 deletions
30
src/main.rs
30
src/main.rs
|
|
@ -2,9 +2,9 @@ trait Project {
|
||||||
type Assoc;
|
type Assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct FutResult<T>(T);
|
pub struct Wrap<T>(T);
|
||||||
|
|
||||||
impl<T> Project for FutResult<T> {
|
impl<T> Project for Wrap<T> {
|
||||||
type Assoc = Result<T, ()>;
|
type Assoc = Result<T, ()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,27 +29,27 @@ where
|
||||||
|
|
||||||
pub struct Map<F>(F);
|
pub struct Map<F>(F);
|
||||||
|
|
||||||
pub trait FnOnce1<A> {
|
|
||||||
type Output;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T, A, R> FnOnce1<A> for T
|
|
||||||
where
|
|
||||||
T: FnOnce(A) -> R,
|
|
||||||
{
|
|
||||||
type Output = R;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<F> Stream for Map<F>
|
impl<F> Stream for Map<F>
|
||||||
where
|
where
|
||||||
F: FnOnce1<()>,
|
F: FnOnce1,
|
||||||
F::Output: Project,
|
F::Output: Project,
|
||||||
{
|
{
|
||||||
type Item = <F::Output as Project>::Assoc;
|
type Item = <F::Output as Project>::Assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait FnOnce1 {
|
||||||
|
type Output;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T, R> FnOnce1 for T
|
||||||
|
where
|
||||||
|
T: FnOnce(()) -> R,
|
||||||
|
{
|
||||||
|
type Output = R;
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let bodies = map(|url| FutResult(Result::Ok(url)));
|
let bodies = map(|url| Wrap(Result::Ok(url)));
|
||||||
|
|
||||||
bodies.for_each(|b| async {
|
bodies.for_each(|b| async {
|
||||||
match b {
|
match b {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue