This repository has been archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1368 from matthiaskrgr/i
add 3 ices
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#![crate_type = "lib"] | ||
|
||
pub trait Backend { | ||
type DescriptorSetLayout; | ||
} | ||
|
||
pub struct Back; | ||
|
||
impl Backend for Back { | ||
type DescriptorSetLayout = u32; | ||
} | ||
|
||
pub struct HalSetLayouts { | ||
vertex_layout: <Back as Backend>::DescriptorSetLayout, | ||
} | ||
|
||
impl HalSetLayouts { | ||
pub fn iter<DSL>(self) -> DSL | ||
where | ||
Back: Backend<DescriptorSetLayout = DSL>, | ||
{ | ||
self.vertex_layout | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
struct Error; | ||
|
||
fn foo() { | ||
let initial_exchange: Result<usize, Error> = todo!(); | ||
initial_exchange.and_then(|_| | ||
serve_udp_tunnel() | ||
).await; | ||
} | ||
|
||
async fn serve_udp_tunnel() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
trait Widget<E> { | ||
type State; | ||
|
||
fn make_state(&self) -> Self::State; | ||
} | ||
|
||
impl<E> Widget<E> for () { | ||
type State = (); | ||
|
||
fn make_state(&self) -> Self::State {} | ||
} | ||
|
||
struct StatefulWidget<F>(F); | ||
|
||
type StateWidget<'a> = impl Widget<&'a ()>; | ||
|
||
impl<F: for<'a> Fn(&'a ()) -> StateWidget<'a>> Widget<()> for StatefulWidget<F> { | ||
type State = (); | ||
|
||
fn make_state(&self) -> Self::State {} | ||
} | ||
|
||
fn new_stateful_widget<F: for<'a> Fn(&'a ()) -> StateWidget<'a>>(build: F) -> impl Widget<()> { | ||
StatefulWidget(build) | ||
} | ||
|
||
fn main() { | ||
new_stateful_widget(|_| ()).make_state(); | ||
} |