並び順

ブックマーク数

期間指定

  • から
  • まで

161 - 200 件 / 251件

新着順 人気順

asyncの検索結果161 - 200 件 / 251件

  • zeke | tcp-proxy

    home A TCP Proxy in 30 lines of Rust Jul 2021 TCP proxies accept connections from one computer and forward them to another. AWS Global Accelerator and Cloudflare Spectrum are examples of TCP proxies you can pay to use in the wild. TCP proxies can be quite simple. Here we’ll write one in 30 some lines of Rust. After we write it we’ll demonstrate the proxy’s functionality by proxying traffic from lo

    • RFC: First class support for promises and async/await by acdlite · Pull Request #229 · reactjs/rfcs

      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

        RFC: First class support for promises and async/await by acdlite · Pull Request #229 · reactjs/rfcs
      • 14 Linting Rules To Help You Write Asynchronous Code in JavaScript

        Debugging asynchronous code in JavaScript can feel like navigating a minefield at times. You don't know when and where the console.logs will print out, and you have no idea how your code is executed. It's hard to correctly structure async code so it executes in the right order as you intend it to. Wouldn't it be nice if you had some guidance while writing asynchronous code, and to get a helpful me

          14 Linting Rules To Help You Write Asynchronous Code in JavaScript
        • How Async/Await Really Works in C# - .NET Blog

          Catch up on 16 sessions from .NET Conf: Focus on AI exploring how .NET developers can leverage AI libraries and features to build smarter applications, enhance productivity, and provide better user experiences. Several weeks ago, the .NET Blog featured a post What is .NET, and why should you choose it?. It provided a high-level overview of the platform, summarizing various components and design de

            How Async/Await Really Works in C# - .NET Blog
          • Async UI: a Rust UI Library where Everything is a Future | Wisha Wanichwecharungruang

            Async UI: a Rust UI Library where Everything is a Future Lifetime-Friendly, Component-Based, Retained-Mode UI Powered by Async Rust This blog post is intended for readers with some experiences in async Rust. It assumes you know what a Future is! What is Async UI? Async UI is a proof-of-concept Rust UI library with backends for the web (HTML/JS) and GTK 4. Screenshots Todo List Demo (interactive ve

            • async/await を完全に理解する

              この記事ではasync/awaitについて完全に理解する[1]ことを目標に説明します。 完全に理解するために一部厳密には正確ではない表現をしますがご了承ください。 (明らかに事実と異なる内容が含まれている場合はご指摘いただけると助かります) ちなみにC#の文法説明になりますが、他の言語でも基本的な考え方は同じはずです。例えばJavaScriptの場合はTask型をPromise型に置き換えていい感じに読んでください。 非同期処理とTask型 async/awaitを完全に理解するためには、非同期処理の扱い方について完全に理解する必要があります。 そもそも非同期処理って何?という方はググってください。同期処理と非同期処理の違いについては完全に理解した前提で説明します。 非同期処理は複数のタスクを同時並行に処理するためのものですが、実際にコードを書いていると非同期で処理しているタスクが終わるま

                async/await を完全に理解する
              • 非同期 Rust パターン - Qiita

                Rust で非同期並列処理を書く時に出てくるパターンについて解説します tokio 1.0 と futures 0.3 環境です async function 編 pic.twitter.com/ihHRXmSaFh — legokichi (@duxca) August 28, 2021 async fn hoge() -> () まずは基本 async fn hoge() -> () { tokio::time::sleep(std::time::Duration::from_millis(100)).await; }

                  非同期 Rust パターン - Qiita
                • GitHub - tokio-rs/axum: Ergonomic and modular web framework built with Tokio, Tower, and Hyper

                  You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                    GitHub - tokio-rs/axum: Ergonomic and modular web framework built with Tokio, Tower, and Hyper
                  • Remixing React Router

                    The first versions of React Router actually had an async hook to help with data loading called willTransitionTo. Nobody really knew how the heck to use React at the time and we were no exception. It wasn't great, but it was at least going in the right direction. For better or for worse, we went all in on components for React Router v4 and removed the hook. With willTransitionTo gone, and component

                      Remixing React Router
                    • GitHub - davnicwil/react-frontload: Async data loading for React components, on client & server

                      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                        GitHub - davnicwil/react-frontload: Async data loading for React components, on client & server
                      • Barcode Detection APIでブラウザ上からQRコードを読み取る

                        我々の生活にQRコードが浸透してから何年経ったでしょうか。QRコードの読み取り機能はOS標準で可能になり、もはや「QRコードアプリ」すら不要な時代になりました。 一方でブラウザにおけるQRコードの取り扱いは、全くサポートされていませんでした。今まではゼロから実装した有志のライブラリを使ってQRコードの読み取りを実装していました。 しかしBarcode Detection APIの実装で、そういったライブラリも不要になるかもしれません。 Shape Detection API 近年になって、ブラウザにShape Detection APIというAPIの策定・実装が始まっています。 Shape Detection APIは現在以下の2つのAPIから構成されています。 Barcode Detection API Face Detection API また、「親戚」として、OCRを実現するText

                          Barcode Detection APIでブラウザ上からQRコードを読み取る
                        • Announcing `async fn` and return-position `impl Trait` in traits | Rust Blog

                          Announcing `async fn` and return-position `impl Trait` in traits The Rust Async Working Group is excited to announce major progress towards our goal of enabling the use of async fn in traits. Rust 1.75, which hits stable next week, will include support for both -> impl Trait notation and async fn in traits. This is a big milestone, and we know many users will be itching to try these out in their o

                            Announcing `async fn` and return-position `impl Trait` in traits | Rust Blog
                          • 【JavaScript】 async/await で非同期処理をわかりやすく記述する - 株式会社ライトコード

                            async/await という仕組み 本記事では、 JavaScript の非同期処理を扱うための async/await という仕組みについて取り上げます。 async/await は、 Promise を利用した非同期処理をよりわかりやすく記述できます。 本題へ進む前に Promie の復習をしておきましょう! Promise の復習 async/await は、 Promise の仕組みを利用しているため、Promise への理解が大切だからです。 非同期関数を作成するときに Promise が利用できます。 Promiseの状態 Promise には、以下の状態があります。 apending: 初期状態、実行中。成功も失敗もしていない fulfilled: 処理が完了した状態。then メソッドを呼び出す rejected: 処理が失敗した状態。then メソッドと catch メ

                              【JavaScript】 async/await で非同期処理をわかりやすく記述する - 株式会社ライトコード
                            • ConfigureAwait FAQ - .NET Blog

                              .NET added async/await to the languages and libraries over seven years ago. In that time, it’s caught on like wildfire, not only across the .NET ecosystem, but also being replicated in a myriad of other languages and frameworks. It’s also seen a ton of improvements in .NET, in terms of additional language constructs that utilize asynchrony, APIs offering async support, and fundamental improvements

                                ConfigureAwait FAQ - .NET Blog
                              • コルーチンは怖くない

                                コルーチンの基本的なアイディアを正確さより雰囲気重視で解説してみました。 一応コルーチンやイベントループによる非同期処理に関しては概念はPythonに限った話ではないのでNode.jsなどでも同じ理解でいいはず。。。 下記のサンプルを全部動かすにはPython 3.6以降を使ってください。(ローカルにない場合はdocker run --rm -it python:3.7とかでもOK) コルーチンとは サブルーチンの上位(?)概念です。 サブルーチン(いわゆる関数)はエントリポイントが一つで、一度呼び出したら値が返されるまで一気に動きます。 これに対しコルーチンはエントリポイントが複数箇所あるため、一度呼び出されても中断でき、その場所からまた再開できるというものです。 async/awaitとネイティブコルーチン Python 3.5でasync/await構文とともに導入されたネイティブコ

                                  コルーチンは怖くない
                                • SpringBootでAsyncを使う時に知っておきたいExecutorのこと - 日々常々

                                  SpringFramework 6.0.11 SpringBoot 3.1.2 @Async と @EnableAsync の使い方 SpringFrameworkで @Async を使うとかんたんにメソッドを非同期で実行できます。 @Component class AsyncComponent { @Async void method() { // 時間のかかる処理 } } 使う側は単にメソッドを呼び出すだけです。戻り値を処理したいなら Future で受ければいいけど、投げっばでいいなら void で良い。投げっばでいい場合の方が多いはず。 @Async を使うためにはアノテーションを処理する何かしらが必要で、この一式を用意するように指示するのが @EnableAsync です。 以下のようなクラスをSpringがわかるところに置いてあげます。 @EnableAsync @Config

                                    SpringBootでAsyncを使う時に知っておきたいExecutorのこと - 日々常々
                                  • Promise.withResolvers によるイベントの Promise 化 | blog.jxck.io

                                    Intro Promise.withResolvers() は、 Stage 4 であり ES2024 の候補となった。 すでにブラウザでの実装も進んでいるため、その活用方法を解説する。 イベントの Promise 化 JS では、非同期処理 API は長らくイベントリスナベースで定義され、それを組み合わせるフロー制御で処理されてきた。 しかし、 Promise が定義されて以降は、標準 API も Promise を返すようになり、 async/await によって処理されるのが一般的になってきた。 結果、イベントリスナベースの API を Promise 化するような場面も増えた。 例えば以下のようなものだ。 async function request() { return new Promise((resolve, reject) => { document.querySelect

                                      Promise.withResolvers によるイベントの Promise 化 | blog.jxck.io
                                    • return と return await の3つの違い

                                      Promise を返す非同期関数を扱うとき Promise をそのまま返す書き方と Promise を await してから返す二通りの方法があります。 const fetchUsers1 = async () => { return axios.get("/users"); }; // または const fetchUsers2 = async () => { return await axios.get("/users"); }; 上記のコード例は一見するとどちらも同じように動作するように思えますが、以下のような違いがあります。 例外がキャッチされる場所 スタックトレースの出力 マイクロタスクのタイミング 例外がキャッチされる場所 初めに考えられるもっとも顕著な例として try/catch ブロックと共に使用されている場合です。端的に説明すると return の場合には関数の呼び出し元

                                        return と return await の3つの違い
                                      • FastAPIの"def"と"async def"って結局「どっちを使えば良いんじゃろう?」 - Qiita

                                        はじめに FastAPIを始めてみたところ、async/await構文があり、Pythonにも「async/await構文があるんだなー」と初めてその存在を知った。 しかし、FastAPIのサンプルコードやネットで公開されているコードを見ると、async defとdefをどのように使い分けているのかよくわからず、結局、「どっちを使えば良いんじゃろう?」という気持ちになったので、async/await、同期 / 非同期(並行処理)を調べつつ、結論を導いてみることにした。 いきなり結論 Path operation 関数の場合、async defではなくdefで、基本、実装する。 defだけでも、外部スレッドプールで非同期処理されるようにフレームワークとして実装されているとのこと async defを使った方が良いのは以下の2ケース async/awaitをサポートしているライブラリを利用した

                                          FastAPIの"def"と"async def"って結局「どっちを使えば良いんじゃろう?」 - Qiita
                                        • FastAPIでPath Operationに def と async def どちらを使うべきか - Carpe Diem

                                          背景 FastAPIでは以下のようにデコレータ関数を使うことでHTTPサーバのpathを設定することができ、これをPath Operationと呼びます。 from fastapi import FastAPI app = FastAPI() @app.get("/") async def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") async def read_item(item_id: int, q: str = None): return {"item_id": item_id, "q": q} このPath Operationでdefを使うべきかasync defを使うべきかの方針を説明します。 環境 Python 3.9.11 FastAPI 0.74.1 方針 結論から言うと以下の方針で

                                            FastAPIでPath Operationに def と async def どちらを使うべきか - Carpe Diem
                                          • なぜasyncの中でformat!を使うとエラーが出るのか - Qiita

                                            2019年11月にリリースされたRust 1.39では,非同期プログラミングを支援するためにasync/awaitが言語機能として導入されました. 機能自体の解説は「Rustの非同期プログラミングをマスターする」などを読んでいただくと良いでしょう. 本稿ではasync/awaitの基本的な知識は前提としたうえでformat!との組み合わせにより生じる不可解なエラーについて解説します. エラー例 次のコードはStringを受け取るasync fnにformat!で作成した文字列を渡し,awaitしています. async fn take_string(_: String) {} fn main() { tokio::spawn(async { take_string(format!("")).await; }); } $ cargo c Checking crate_name v0.1.0 (

                                              なぜasyncの中でformat!を使うとエラーが出るのか - Qiita
                                            • GitHub - emacs-ng/emacs-ng: A new approach to Emacs - Including TypeScript, Threading, Async I/O, and WebRender.

                                              You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                GitHub - emacs-ng/emacs-ng: A new approach to Emacs - Including TypeScript, Threading, Async I/O, and WebRender.
                                              • [JS]なぜawaitはasync関数の中にしか書けないのか - Qiita

                                                先に結論 awaitが使われている関数はジェネレータとして内部的に変換され、非同期処理になる。 その為、async関数である必要がある。 コンパイラから見ても、asyncが付いていることで効率的にコンパイルできる。 (追記 2021/07/21)最上位でのawaitは、もうすぐ可能になるかもしれない(一部ブラウザは実装済)。(鶏(async)が先か卵(await)が先かでコメントで教えて頂きました。感謝!) というわけで本編 awaitはPromiseを返す関数を呼び出す方法として非常に便利ですが、それを使う箇所にはいちいちasyncを付けて回らなければならないのが面倒だと思ったことはないでしょうか。 そもそもawaitを内部で使っている関数が常にasyncである必要性がいまいちピンと来ない方もいるのではないでしょうか(最初にasync/awaitの構文を見た時、私自身がそうでした)。 例

                                                  [JS]なぜawaitはasync関数の中にしか書けないのか - Qiita
                                                • The State of Async Rust: Runtimes | corrode Rust Consulting

                                                  Recently, I found myself returning to a compelling series of blog posts titled Zero-cost futures in Rust by Aaron Turon about what would become the foundation of Rust's async ecosystem and the Tokio runtime. This series stands as a cornerstone in writings about Rust. People like Aaron are the reason why I wanted to be part of the Rust community in the first place. While 2016 evokes nostalgic memor

                                                    The State of Async Rust: Runtimes | corrode Rust Consulting
                                                  • Async Clipboard API

                                                    Safari 13.1 adds support for the async Clipboard API. This API allows you, as web developers, to write and read data to and from the system clipboard, and offers several advantages over the current state of the art for reading and writing clipboard data via DataTransfer. Let’s take a look at how this new API works. The API The Clipboard API introduces two new objects: Clipboard, which is accessibl

                                                    • I'm not feeling the async pressure

                                                      I'm not feeling the async pressure written on Wednesday, January 1, 2020 Async is all the rage. Async Python, async Rust, go, node, .NET, pick your favorite ecosystem and it will have some async going. How good this async business works depends quite a lot on the ecosystem and the runtime of the language but overall it has some nice benefits. It makes one thing really simple: to await an operation

                                                      • Building a shared vision for Async Rust | Rust Blog

                                                        The Async Foundations Working Group believes Rust can become one of the most popular choices for building distributed systems, ranging from embedded devices to foundational cloud services. Whatever they're using it for, we want all developers to love using Async Rust. For that to happen, we need to move Async Rust beyond the "MVP" state it's in today and make it accessible to everyone. We are laun

                                                          Building a shared vision for Async Rust | Rust Blog
                                                        • 非同期処理、なにもわからない

                                                          最近のお仕事で、C#の非同期処理の書き方が分からずに、溶岩地帯に自爆していくコードを沢山みるようになったので、ケースとして日常風の記事にしてみました。 どんな風にハマってしまい、どうやって解決するのかが分かると思います。 結論 先に書いておきます。 Task.Run()を使ってはいけません Task.Result, Task.Wait()を使ってはいけません Threadクラスを使ってはいけません async-await構文だけを使って書きます async voidにするのは特殊な場合だけです がんばれー、わかってしまえば難しくない! 補足: もしあなたがJavaScriptで非同期処理を書いた事があるなら、その知識をそのまま生かせます。 JavaScriptではTaskの代わりにPromiseを使いますが、Promiseには上記1,2,3は存在しません。しかし、それで困ることはありません

                                                            非同期処理、なにもわからない
                                                          • Tonic: gRPC has come to async/await!

                                                            Tonic: gRPC has come to async/await! I am pleased to finally announce a crate that I have been working very hard on for the past few months. tonic has finally hit the initial 0.1.0-alpha.1 release! Stable releases will follow in the coming months. What is Tonic? Tonic is a gRPC-over-HTTP/2 implementation focused on high performance, interoperability, and flexibility. This library was created to ha

                                                            • Rustが1.39でゼロコストAsync/Awaitをサポート

                                                              Spring BootによるAPIバックエンド構築実践ガイド 第2版 何千人もの開発者が、InfoQのミニブック「Practical Guide to Building an API Back End with Spring Boot」から、Spring Bootを使ったREST API構築の基礎を学んだ。この本では、出版時に新しくリリースされたバージョンである Spring Boot 2 を使用している。しかし、Spring Boot3が最近リリースされ、重要な変...

                                                                Rustが1.39でゼロコストAsync/Awaitをサポート
                                                              • 誤用しがちな Promise.all

                                                                非同期処理を並列実行するときに便利な Promise.all() ですが、雑に使ってしまうと意図した挙動にならないことがあります。 まとめ Promise.all 内で関数を定義する際は即時実行関数式にしなければ実行されない Promise.all に渡す際に await してしまうと意図せず直列処理になってしまう サンプルコード 以下のコードで例示した①・②・③・④のうち、期待した挙動にならないものがあります。 (いずれの実行もエラーにならないものとします) let response; const syncFn = () => {}; const asyncFn = async () => {}; const results = await Promise.all([ // ① syncFn(), // ② asyncFn(), // ③ async () => { const data

                                                                  誤用しがちな Promise.all
                                                                • 【JavaScript】「とりあえずawait」は卒業しよう - echo("備忘録");

                                                                  概要 先日、非同期処理に関して、下記のようなツイートをしました。 ・非同期処理A〜Cの3つ ・全て成功した場合のみ処理Dを実行 ・A〜Cは依存関係なし 上記ケースで、お約束かのように await A await B await C と書く事がないように、若手を指導しなければなあ。— Masaki Suzuki@フリーランスクラウドエンジニア (@makky12) 2020年1月9日 このツイートに対して、思った以上に反響を頂いた(と思う)ので、今回もう一度async/awaitのことを記事にしました。 ちなみに前回書いたasync/await関連の記事はこちら。 makky12.hatenablog.com なお今回の記事を書くにあたり、下記ブログを参考にしました。 (ブログを書こうと思ったきっかけもこれを見たから) 「メソッド実行とawaitの分離」の書き方など、役立つソースが多いです。

                                                                    【JavaScript】「とりあえずawait」は卒業しよう - echo("備忘録");
                                                                  • Why I’m building a new async runtime | Stjepan’s blog

                                                                    Rust has a relatively new async/await system, and one of its peculiarities is that it doesn’t have a runtime baked in like many other programming languages do. To write an async program, you have to pick a library like async-std or tokio, or implement a runtime on your own. The apparent competition between async-std and tokio to become the one true runtime has created the dreaded ecosystem split,

                                                                    • Bolt.js⚡ + Firebase🔥で技術投稿の指標を良い感じに集計してくれるSlack Botを作った

                                                                      いかに楽に入力できるか、いかに楽に自分の進捗を把握できるかに着目して作りました。 入力については、Slack アカウトごとに前回入力済みの内容を Firestore に保存し、初回以降は入力欄の初期値として入るようにしています。 進捗把握については、初回以降は前回の実行時からの差分を表示するようにしています。なので週 1 回とかコマンドを打てば前週との比較が手軽に出来ます。 構成 どのような構成かざっくり紹介します。 Bolt.js を Cloud Functions for Firebase で動かして Slack とのやりとりをしています。 そして、フォームの入力内容・指標データを Firestore に保存しています。 指標集計部分は自分で各サービスの API クライントを書いて使っています。 Zenn の API クライアント import { ZennArticle, Follo

                                                                        Bolt.js⚡ + Firebase🔥で技術投稿の指標を良い感じに集計してくれるSlack Botを作った
                                                                      • Different levels of async in Rust

                                                                        First there was cooperative multiprocessing. Then there were processes. An operating system could run multiple processes, each performing a series of sequential, blocking actions. Then came threads. A single processes could spawn off multiple threads, each performing its own series of sequential, blocking actions. (And really, the story starts earlier, with hardware interrupts and the like, but ho

                                                                          Different levels of async in Rust
                                                                        • WWDC 2021のSwiftの並行処理関連のセッション一覧 - Qiita

                                                                          WWDC 2021 が始まりました。 今年は Swift 5.5 で並行処理の大型アップデートが予定 されており、長年待ち望まれていた async/await に加えて、さらに先進的な Structured Concurrency や Actor なども導入されます。そのため、 WWDC 2021 では並行処理関連のセッションが多数予定されています。 そこで、セッション一覧から並行処理関連のものを探して一覧にしてみました。内容はまだわかりませんが、個人的に重要度が高そうだと思う順に並べてみました。各セッション下部のリンクは内容に関係しそうな Proposal です。 (感想) は実際にそのセッションを見た感想です。 もし抜け漏れなどあればコメント下さい🙇 What‘s new in Swift これは並行処理についてのセッションではないですが、 Swift 5.5 での新機能の大きな割合

                                                                            WWDC 2021のSwiftの並行処理関連のセッション一覧 - Qiita
                                                                          • use – React

                                                                            他のあらゆる React フックとは異なり、use は if のようなループや条件文内でも呼び出すことができます。他の React フックと同様に、use を呼び出す関数はコンポーネントまたはフックでなければなりません。 プロミスを引数にして呼び出した場合、use フックは Suspense やエラーバウンダリ (error boundary) と協調して動作します。use を呼び出すコンポーネントは、use に渡されたプロミスが保留中 (pending) である間、サスペンド (suspend) します。use を呼び出すコンポーネントがサスペンスバウンダリでラップされている場合、フォールバックが表示されます。プロミスが解決 (resolve) された時点で、サスペンスフォールバックは、use フックから返されたデータを使用してレンダーされたコンポーネントの内容に置き換わります。use

                                                                              use – React
                                                                            • Async/Await | Writing an OS in Rust

                                                                              In this post, we explore cooperative multitasking and the async/await feature of Rust. We take a detailed look at how async/await works in Rust, including the design of the Future trait, the state machine transformation, and pinning. We then add basic support for async/await to our kernel by creating an asynchronous keyboard task and a basic executor. This blog is openly developed on GitHub. If yo

                                                                              • Async Exceptions in Haskell, and Rust

                                                                                Before getting started: no, there is no such thing as an async exception in Rust. I'll explain what I mean shortly. Notice the comma in the title :). GHC Haskell supports a feature called asynchronous (or async) exceptions. Normal, synchronous exceptions are generated by the currently running code from doing something like trying to read a file that doesn't exist. Asynchronous exceptions are gener

                                                                                  Async Exceptions in Haskell, and Rust
                                                                                • GitHub - bytedance/monoio: Rust async runtime based on io-uring.

                                                                                  Monoio is a pure io_uring/epoll/kqueue Rust async runtime. Part of the design has been borrowed from Tokio and Tokio-uring. However, unlike Tokio-uring, Monoio does not run on top of another runtime, rendering it more efficient. Moreover, Monoio is designed with a thread-per-core model in mind. Users do not need to worry about tasks being Send or Sync, as thread local storage can be used safely. I

                                                                                    GitHub - bytedance/monoio: Rust async runtime based on io-uring.

                                                                                  新着記事