diff options
Diffstat (limited to 'users/tazjin/presentations/tvix-eval-2023')
11 files changed, 1302 insertions, 0 deletions
diff --git a/users/tazjin/presentations/tvix-eval-2023/README.md b/users/tazjin/presentations/tvix-eval-2023/README.md new file mode 100644 index 000000000000..b14ba8ff5006 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/README.md @@ -0,0 +1,12 @@ +These are the slides for a talk at the Moscow Rust User Group / +ProgMSK on 2023-09-07. + +After building, the presentation can be launched with `pdfpc` +(available in `nixpkgs`), like this: + +``` +pdfpc --windowed=both result/presentation.pdf -R presentation.pdfpc -d 40 +``` + +I keep the JSON file formatted using `jq . presentation.pdfpc | sponge +presentation.pdfpc` for easier diffs. diff --git a/users/tazjin/presentations/tvix-eval-2023/cppnix-example-lexer.cpp b/users/tazjin/presentations/tvix-eval-2023/cppnix-example-lexer.cpp new file mode 100644 index 000000000000..7c52bce8b6d2 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/cppnix-example-lexer.cpp @@ -0,0 +1,13 @@ +attrpath + : attrpath '.' attr { + $$ = $1; $1->push_back(AttrName(data->symbols.create($3))); + } + | attrpath '.' string_attr + { $$ = $1; + ExprString * str = dynamic_cast<ExprString *>($3); + if (str) { + $$->push_back(AttrName(data->symbols.create(str->s))); + delete str; + } else + $$->push_back(AttrName($3)); + } diff --git a/users/tazjin/presentations/tvix-eval-2023/cppnix-example-smuggling.cpp b/users/tazjin/presentations/tvix-eval-2023/cppnix-example-smuggling.cpp new file mode 100644 index 000000000000..37b9219b2eac --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/cppnix-example-smuggling.cpp @@ -0,0 +1,12 @@ +struct Env { + // ... some struct fields ... + Value* values[0]; +}; + +// .... + +if (env->type == Env::HasWithExpr) { + // ... + evalAttrs(*env->up, (Expr *) env->values[0], *v, noPos, "<borked>"); + // ^^^^^^^^^^^^^^^^^^^^^^^ +} diff --git a/users/tazjin/presentations/tvix-eval-2023/default.nix b/users/tazjin/presentations/tvix-eval-2023/default.nix new file mode 100644 index 000000000000..a4d855197c5e --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/default.nix @@ -0,0 +1,63 @@ +{ depot, pkgs, ... }: + +let + inherit (pkgs) fontconfig texlive stdenv imagemagick runCommand qrencode; + + tex = texlive.combine { + inherit (texlive) + babel + babel-russian + beamer + beamertheme-metropolis + etoolbox + euenc + extsizes + fontspec + listings + xetex + minted + ms + pgfopts + scheme-basic + translator; + }; + + linksQrCode = runCommand "qrcode.png" { } '' + ${qrencode}/bin/qrencode -o code.png -s 8 \ + --background=fafafa \ + --foreground=000000 \ + 'https://tazj.in/blog/tvix-eval-talk-2023' + + # latex has trouble with the PDF produced by qrencode + ${imagemagick}/bin/convert code.png $out + ''; +in +stdenv.mkDerivation { + name = "progmsk-tvix-eval"; + src = ./.; + + nativeBuildInputs = [ tex imagemagick fontconfig ]; + + FONTCONFIG_FILE = pkgs.makeFontsConf { + fontDirectories = with pkgs; [ jetbrains-mono fira fira-code fira-mono ]; + }; + + buildPhase = '' + # LaTeX needs a cache folder in /home/ ... + mkdir home + export HOME=$PWD/home + + cp ${depot.tvix.logo}/logo.png tvix-logo.png + cp ${linksQrCode} qrcode.png + + # As usual, TeX needs to be run twice ... + ${tex}/bin/xelatex presentation.tex + ${tex}/bin/xelatex presentation.tex + ''; + + installPhase = '' + mkdir -p $out + cp presentation.pdf $out/ + cp $src/presentation.pdfpc $out/ + ''; +} diff --git a/users/tazjin/presentations/tvix-eval-2023/presentation.pdfpc b/users/tazjin/presentations/tvix-eval-2023/presentation.pdfpc new file mode 100644 index 000000000000..ab5cba68bf45 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/presentation.pdfpc @@ -0,0 +1,98 @@ +{ + "pdfpcFormat": 2, + "duration": 40, + "disableMarkdown": false, + "noteFontSize": 20, + "pages": [ + { + "idx": 1, + "label": "2", + "overlay": 0, + "note": "Привет, меня зовут .... Я уже много лет, с 2016г. примерно, пишу на Расте, и хотя на работе у меня часто бывают другие языки, Раст - любимый мой язык.\n\nПару лет назад, во время Кодида, я создал онлайн-коммюнити ТВЛ, и сегодня хочу вам об одном из наших проектов рассказать." + }, + { + "idx": 2, + "label": "3", + "overlay": 0, + "note": "монорепо: объяснить. Весь код орга в одном месте. Единный тулинг. Много из нас раньше работали в компаниях, где так делают (нп Гугл).\n\nМы хотели создать такой же тулинг, но открыто. Но у нас меньше ресурсов чем у Гугла, намного меньше. Пришлось выбрать эфф. способ.\nФокусируем на Никс, потому что (...). Есть доклад.\n\nМы начали его не только для пакетов использовать (конфиг и тд.), хотелось решение, которое работает везде." + }, + { + "idx": 3, + "label": "4", + "overlay": 0, + "note": "Будем фокусировать только на язык сейчас. Остальные части интересные, но не сегодня.\nЯзык ленивый, значит только вычисляем код, когда его результат нужен где-то.\nЗначит, нам нужен рантайм-представление отложенных вычислений.\nОрганично развивался: добавили фичи, когда нуждались. Много функтции работают только случайно, комбинации фич - часто странно. (шутка про С++?)\nНо есть хороший фактор: весь публичный код в принципе в одном репо. Объяснять nixpkgs." + }, + { + "idx": 4, + "label": "5", + "overlay": 0, + "note": "Текушая имплементация на С++. Вот пример. Кто-то здесь понимает, что мы видем? Это часть парсера в як, но тут создают рантайм-значения во время парсинга. Очень сложно понимать, читать, дебажить и так далее.\nЧитали парсер, и даже нашли там неизвестные фичи языка." + }, + { + "idx": 5, + "label": "6", + "overlay": 0, + "note": "Второй пример. Есть стракт Env, которая используется во многих местах в коде. Там массив типа Value.\nВот использование этого массива. Что мы видем? Кто понимает?\nДа, там на самом деле происходит каст на другой тип. Значит, в структуре добавляют данные, которые не подойдет. Очень unsafe!\n\nДа, что же делать? Пытались почистить код, но случилось burnout очень быстро. Меняешь одну маленькую штуку -> segfaults.\nПочему код вот такой? -> объяснять.\nПришлась очевидная идея." + }, + { + "idx": 6, + "label": "6", + "overlay": 1, + "note": "Переписать проекты полностью, обычно очень сложно. Но мы можем менять арх., и обходить переписивание некоторых частей.\nРаст - нам очевидный выбор для имплементация языка. Много нас знают Раст, и в целом, почему именно Раст, вы уже сами понимаете.\n\nМы от NLNet, организация, ..., получили денги за этого и начали с языком. Этот проект называем tvix-eval.\n\nЕсть еще одна важная причина для выбора Раста." + }, + { + "idx": 7, + "label": "6", + "overlay": 2, + "note": "Пару лет назад, шведский парень юзернеймом, который нельзя происносить, написал на Расте очень быстрый и в целом хороший парсер для Никса.\nЭтот парсер уже используется в разных с Никсом связанных проектах. Он скорее всего в пути стать дефольтним парсером Никса.\nКонечно, неплохо если мы его тоже используем.\nК сожалению, автор рникса умерл в 2021 году. Мали исвестно о том, что случилось. Мы ему очень благодарные, и я просто хотел его здесь упомянуть." + }, + { + "idx": 9, + "label": "8", + "overlay": 0, + "note": "показать opcode.rs, compiler/mod (compile_binop)\n\nчтобы он не разжирел (про variant_size_differences)\n" + }, + { + "idx": 10, + "label": "9", + "overlay": 0, + "note": "показать value/mod.rs, потом value/list.rs\n\nкороткая объяснение ситуации с Gc<...> vs. Rc<...>" + }, + { + "idx": 11, + "label": "10", + "overlay": 0, + "note": "показать vm/mod.rs\n\nпоследовательно выпольняет инструктции в execute_bytecode\n\nсначала на алфавитным порядке, потом с помощью профайлера меняли это" + }, + { + "idx": 12, + "label": "10", + "overlay": 1, + "note": "показать диаграмму\n\nгенераторый можно приостановить\n\nTCO - хвостовый вызов\n\nasync - очень наязчивный (intrusive), надо было его везде добавить, неудоб" + }, + { + "idx": 13, + "label": "10", + "overlay": 2, + "note": "Зависимо от времени, можно либо только про tvixbolt, либо тоже про тесты из cppnix" + }, + { + "idx": 14, + "label": "11", + "overlay": 0, + "note": "на самом деле удивительно легко, но сталкивались с проблемой, что он иногда перестал работать\n\nпоказать пример с SystemTime::now\n\nесть кое-какие библиотеки, которые мб помогут, но мы их пока не проверили\n\nв целом, wasm на расте довольно удобно" + }, + { + "idx": 15, + "label": "12", + "overlay": 0, + "note": "открытый проект, принимаем коммиты от всех\n\nесть еще баги, TODOs, и тд в tvix-eval\n\nно есть тоже остальные части твикса, что-то найдется" + }, + { + "idx": 16, + "label": "13", + "overlay": 0, + "note": "спасибо всем, вот ссылки, на QR-коде есть все вот этот вот, и там тоже потом добавлю сам доклад\n\nеще завтра начинается NixCon, если вам вдруг интересно, можно онлайн посмотреть. Там будет доклад про tvix тоже, но об остальных частях." + } + ] +} diff --git a/users/tazjin/presentations/tvix-eval-2023/presentation.tex b/users/tazjin/presentations/tvix-eval-2023/presentation.tex new file mode 100644 index 000000000000..294dad794287 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/presentation.tex @@ -0,0 +1,148 @@ +\documentclass[12pt]{beamer} + +\usepackage[utf8]{inputenc} +\usepackage[main=russian,english]{babel} +\usepackage{fontspec} +\usepackage{listings} + +\setmainfont{JetBrains Mono} +\setsansfont{JetBrains Mono} + +\usetheme{metropolis} +\newenvironment{code}{\ttfamily}{\par} +\title{tvix-eval \\ компилятор и рантайм для Nix, на Rust} + +\titlegraphic{\vspace{4.8cm}\flushright\includegraphics[width=6cm,keepaspectratio=true]{tvix-logo.png}} + +\date{2023-09-07} +\author{Винсент Амбо} +\institute{TVL} + +\begin{document} + %% Slide -1 (before counter): + \begin{frame} + \begin{center} + \titlepage + \end{center} + \end{frame} + + %% Slide 0 (title): + \begin{frame} + \begin{center} + \titlepage + \end{center} + \end{frame} + + %% Slide 1: + \begin{frame}{\textbf{Т}he \textbf{V}irus \textbf{L}ounge} + \begin{itemize} + \item онлайн-комьюнити, занимающееся тулингом для монорепо + \item основной фокус на Nix + \item Nix не только для сборки пакетов + \item Хотелось решение, чтобы использовать Nix везде + \end{itemize} + \end{frame} + + %% Slide 2: + \begin{frame}{Особенности языка Nix} + \begin{itemize} + \item Ленивый язык. Вычислять все сразу нельзя. + \item Язык развивался органично. + \item Большинство кода на Nix --- в одном месте: \begin{code}nixpkgs\end{code} + \end{itemize} + \end{frame} + + %% Slide 3: + \begin{frame}{Текущая имплементация: C++ Nix} + \lstinputlisting[ + language=c++, + basicstyle={\scriptsize} + ]{cppnix-example-lexer.cpp} + \end{frame} + + %% Slide 4: + \begin{frame}{Текущая имплементация: C++ Nix} + \lstinputlisting[ + language=c++, + basicstyle={\scriptsize} + ]{cppnix-example-smuggling.cpp} + \end{frame} + + %% Slide 5: + \section{``Let's rewrite it in Rust!''} + + %% Slide 6: + \section*{Спасибо, jD91mZM2!\\\normalsize{автор ``rnix-parser''; *2002 - \textdagger 2021}} + + %% Slide 7: + \begin{frame}{tvix-eval, - (язык) Nix, на Rust} + \begin{itemize} + \item написано с существующим парсером + \item bytecode-интерпретатор, вместо tree-walk + \item должна работать не только для остальных частей tvix + \end{itemize} + \end{frame} + + %% Slide 8: + \begin{frame}{tvix-eval, основные части} + \begin{enumerate} + \item собственный байткод и компилятор + \end{enumerate} + \end{frame} + + %% показать opcode.rs, быстро показать compiler/mod.rs + + %% Slide 9: + \begin{frame}{tvix-eval, основные части} + \begin{enumerate} + \item собственный байткод и компилятор + \item представление значений языка в рантайме + \end{enumerate} + \end{frame} + + %% показать Value + + %% Slide 10: + \begin{frame}{tvix-eval, основные части} + \begin{enumerate} + \item собственный байткод и компилятор + \item представление значении языка в рантайме + \item ... и сам рантайм! + \end{enumerate} + \end{frame} + + %% показать VM + + \section{``Подожди, написать рантайм же не так просто?''} + + %% объяснить проблему со стеком и решение, показать диаграмму + + \section{``А откуда знаешь, что это все правильно работает?''} + + %% показать как тесты работают + %% объяснить дебагинг, Твиксболт и тд + + %% Slide 10: + \begin{frame}{tvix-eval, в браузере} + \begin{itemize} + \item удивительно легко делать + \item но есть сложности в \begin{code}std::\end{code} + % показать пример + \end{itemize} + \end{frame} + + %% Slide 11: + \begin{frame}{А что дальше?} + В tvix-eval есть еще кое-какие интересные проблемы. Может ты их + решишь? + \end{frame} + + \begin{frame}{Спасибо!} + \begin{center} + \includegraphics[width=6cm,keepaspectratio=true]{qrcode.png} + + https://tazj.in/blog/tvix-eval-talk-2023 \\ + t.me/tazjin | t.me/tazlog + \end{center} + \end{frame} +\end{document} diff --git a/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/.gitignore b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/.gitignore new file mode 100644 index 000000000000..73b9c106db62 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/.gitignore @@ -0,0 +1,2 @@ +target/ +dist/ diff --git a/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/Cargo.lock b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/Cargo.lock new file mode 100644 index 000000000000..ef879254cbc3 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/Cargo.lock @@ -0,0 +1,899 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "gloo" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-history", + "gloo-net", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", + "gloo-worker", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" +dependencies = [ + "gloo-events", + "gloo-utils", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-worker" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console", + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "implicit-clone" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c6ecbd987bb94f1f3c76c6787879756cf4b6f73bfff48d79308e8c56b46f65f" +dependencies = [ + "indexmap", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pinned" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" +dependencies = [ + "futures", + "rustversion", + "thiserror", +] + +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prokio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" +dependencies = [ + "futures", + "gloo", + "num_cpus", + "once_cell", + "pin-project", + "pinned", + "tokio", + "tokio-stream", + "wasm-bindgen-futures", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "serde" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_derive" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "pin-project-lite", +] + +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "wasm-fs-demo" +version = "0.1.0" +dependencies = [ + "yew", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "yew" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc" +dependencies = [ + "console_error_panic_hook", + "futures", + "gloo", + "implicit-clone", + "indexmap", + "js-sys", + "prokio", + "rustversion", + "serde", + "slab", + "thiserror", + "tokio", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro", +] + +[[package]] +name = "yew-macro" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301" +dependencies = [ + "boolinator", + "once_cell", + "prettyplease", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] diff --git a/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/Cargo.toml b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/Cargo.toml new file mode 100644 index 000000000000..4a445065e441 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "wasm-fs-demo" +version = "0.1.0" +edition = "2021" + +[dependencies] +yew = { version = "0.20.0", features = [ "csr" ]} diff --git a/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/index.html b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/index.html new file mode 100644 index 000000000000..e024c466cd21 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/index.html @@ -0,0 +1,7 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>wasm-fs-demo</title> + </head> +</html> diff --git a/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/src/main.rs b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/src/main.rs new file mode 100644 index 000000000000..4ad177ad7a94 --- /dev/null +++ b/users/tazjin/presentations/tvix-eval-2023/wasm-fs-demo/src/main.rs @@ -0,0 +1,41 @@ +use std::time::{SystemTime, UNIX_EPOCH}; +use yew::prelude::*; + +fn time_example() -> Html { + let epoch = match SystemTime::now().duration_since(UNIX_EPOCH) { + Ok(duration) => duration.as_secs(), + Err(err) => { + return html! { + format!("failed to calculate duration: {}", err) + } + } + }; + + html! { + <p> + {"Seconds since epoch: "}{epoch} + </p> + } +} + +struct App; +impl Component for App { + type Message = (); + type Properties = (); + + fn create(_: &Context<Self>) -> Self { + Self + } + + fn update(&mut self, _: &Context<Self>, _: Self::Message) -> bool { + false + } + + fn view(&self, _: &Context<Self>) -> Html { + time_example() + } +} + +fn main() { + yew::Renderer::<App>::new().render(); +} |