The vendored January tree did not parse at all on a current nightly: 36 errors in iris-core, all from one syntax change. `impl const Trait for T` is now `const impl Trait for T`, with generics on the `impl`. Bounds are unaffected, and the traits were already declared `const trait` -- so the diagnosis recorded in RUST.md was wrong, and pinning back to a January nightly would only have deferred this. Everything else (the unresolved UiVec2/Vec2/impl_op imports, a Color<u8> resolving to wgpu_types::Color) cascaded from the seven files that failed to parse. The pin is dated rather than `nightly` because that is exactly the failure: a rolling channel moving under a build Dev Updater runs unattended. It carries the components and Android targets too, so a fresh clone provisions itself. Also drops two `#![feature]` gates the compiler reports as declared and unused, since the build stays warning-clean, and takes rustfmt's import order in attr.rs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
649 B
Rust
24 lines
649 B
Rust
use crate::{UiRsc, WeakWidget, WidgetIdFn, WidgetLike};
|
|
|
|
pub trait WidgetAttr<Rsc, W: ?Sized> {
|
|
type Input;
|
|
fn run(rsc: &mut Rsc, id: WeakWidget<W>, input: Self::Input);
|
|
}
|
|
|
|
pub trait Attrable<Rsc, W: ?Sized, Tag> {
|
|
fn attr<A: WidgetAttr<Rsc, W>>(self, input: A::Input) -> impl WidgetIdFn<Rsc, W>;
|
|
}
|
|
|
|
impl<Rsc: UiRsc, WL: WidgetLike<Rsc, Tag>, Tag> Attrable<Rsc, WL::Widget, Tag> for WL {
|
|
fn attr<A: WidgetAttr<Rsc, WL::Widget>>(
|
|
self,
|
|
input: A::Input,
|
|
) -> impl WidgetIdFn<Rsc, WL::Widget> {
|
|
|rsc| {
|
|
let id = self.add(rsc);
|
|
A::run(rsc, id, input);
|
|
id
|
|
}
|
|
}
|
|
}
|