The JIT that runs makepad apps from source: lexer, front end, type checker, lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and warm/cold caches keyed by compiler stamp, provided crates bound late, startup images, live patching. User-facing name is `makepad run` (binary `makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal library name. `makepad check` reports rustc-style diagnostics with rustc error codes and checks a whole workspace (`--workspace`). Runs on macOS, Linux, Windows and Android. makepad-remote: one tool schema for apps and the WM (app/1): grabs, captures, traces, frame profiles and tweaks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
22 lines
1,006 B
Rust
22 lines
1,006 B
Rust
struct S(u32);
|
|
fn offer(out: &mut Vec<S>, s: Option<S>) { if let Some(s) = s { out.push(s) } }
|
|
fn offer_reach<T>(out: &mut Vec<S>, ranked: impl IntoIterator<Item = (f64, T)>, tol: f64, mut chip: impl FnMut(T) -> Option<S>) {
|
|
for (d, item) in ranked { if d > tol { break; } offer(out, chip(item)); }
|
|
}
|
|
fn ranked(found: Vec<(f64, usize, Vec<u32>)>) -> impl Iterator<Item = (f64, (usize, Vec<u32>))> {
|
|
found.into_iter().map(|(d, p, s)| (d, (p, s)))
|
|
}
|
|
fn chip(scheme: &[u32], label: String) -> Option<S> { Some(S(scheme.len() as u32 + label.len() as u32)) }
|
|
fn main() {
|
|
let mut out = Vec::new();
|
|
offer_reach(&mut out, ranked(vec![(1.0, 0, vec![1, 2])]), 2.0, |(_, scheme)| chip(&scheme, String::new()));
|
|
let named: Vec<(f64, (String, Vec<u32>))> = vec![(0.5, ("a".to_string(), vec![3]))];
|
|
offer_reach(&mut out, named, 2.0, |(label, scheme)| chip(&scheme, label));
|
|
assert_eq!(out.len(), 2);
|
|
println!("{}", out.len());
|
|
}
|
|
|
|
#[test]
|
|
fn closure_arg_projection_infer() {
|
|
main();
|
|
}
|