Rust:我在桌面、流動裝置與網頁重用程式碼的秘密武器
Rust: My secret weapon for code reuse in desktops, mobile, and web
Tunc 以 Rust 共用網頁版 Tunc Doc 與桌面及流動版 Tunc Hub 的程式碼,涵蓋即時通訊和數據韌性,並透過 WebAssembly 在瀏覽器執行共用邏輯。大型智能體修改可採用原子儲存路徑,到下次儲存或重新開啟才會顯示;過期狀態及衝突仍須小心處理。
My own independent alternative to Google Docs reuses Tunc WebSocket communications to deliver co-editing features in native Hub and the browser. Tunc Rust code rebases anchored changes and reports explicit conflicts. The same editing rules support people and agents contributing to a draft.
WebAssembly runs shared Rust logic in the browser, with adapters for its APIs. It means that much of the Tunc codebase is shared between web-based Tunc Doc document editing and Tunc Hub desktop and mobile applications. That shared code covers real-time communications and data resilience; the same code runs in the web browser as WebAssembly, and also powers desktop and mobile on all platforms. All thanks to Rust.
We still have to handle stale state and conflicts carefully. Large agent changes can take an atomic storage path and appear after the next save or reopening, rather than arriving live.
Explore the service during the soft opening: https://tuncdoc.com/
The language and library maintainers make this reuse practical. Their work deserves credit alongside the service built on it.
來源:DEV Community · dev.to