It should be possible to safely project through pinned user types:
struct Data<F: Future> {
future: F,
output: Option<F::Output>,
}
impl<F: Future> Data<F> {| #!/usr/bin/env -S cargo +nightly -Zscript | |
| ---cargo | |
| [package] | |
| edition="2021" | |
| [dependencies] | |
| clap = { version = "4.2", features = ["derive"] } | |
| safetensors = "0.4.2" | |
| colored = "2.0" | |
| regex = "1.5" |
| import Browser | |
| import Html exposing (Html, Attribute, div, input, text, button) | |
| import Html.Attributes exposing (..) | |
| import Html.Events exposing (onInput, onClick) | |
| import Dict exposing (Dict) | |
| main = | |
| Browser.sandbox { init = init, update = update, view = view } |
| ### A Pluto.jl notebook ### | |
| # v0.16.1 | |
| using Markdown | |
| using InteractiveUtils | |
| # This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). | |
| macro bind(def, element) | |
| quote | |
| local el = $(esc(element)) |
| #![allow(dead_code)] | |
| const L_COL: u64 = 0xFF00000000000000; | |
| const R_COL: u64 = 0x00000000000000FF; | |
| const B_ROW: u64 = 0x0101010101010101; | |
| const T_ROW: u64 = 0x8080808080808080; | |
| const B_ROWS: u64 = !T_ROW; | |
| const R_COLS: u64 = !L_COL; |
| type Card = (Int, Int) | |
| type Deck = [Card] | |
| type Hand = [Card] | |
| collase_one :: Hand -> Hand | |
| collase_one ((_, ra) : _ : _ : (_, rb) : rest) | ra == rb = rest | |
| collase_one (a@(sa, _) : _ : _ : b@(sb, _) : rest) | sa == sb = [a, b] ++ rest | |
| collase_one t = t | |
| collape_all :: Hand -> Hand |
| use std::cmp::min; | |
| use std::usize::MAX as NUM_MAX; | |
| const MAX: usize = 1000000; | |
| fn main() { | |
| // statically-allocated list used by `amicable` to mark numbers | |
| let mut marks = [0; MAX + 1]; | |
| let (min, len) = (1..marks.len()) | |
| .flat_map(|n| amicable(n, &mut marks)) // flat map to ignore `None`s |
| /** | |
| * An accurate simulation of the elytra item as of Minecraft 15w41b | |
| */ | |
| public class ElytraModel | |
| { | |
| public int glideTime; | |
| public int damageTaken; | |
| public double posX; | |
| public double posY; |
| (function() { | |
| var arr = function(length, fill) { | |
| var arr = []; | |
| for (var i = 0; i < length; i++) | |
| { | |
| arr.push(fill); | |
| } | |
| return arr; | |
| }; | |