Blog
My Experience of Using Rust
Advantages Error handling is a step ahead of Go, more robust. A more robust service is less worrisome. Error declaration (very intuitive) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #[derive(Debug, thiserror::Error)] pub enum InfoFetchError { #[error("Failed to send HTTP request: {0}")] SendHttpRequestError(reqwest::Error), #[error("HTTP response error: {0}")] HttpResponseError(reqwest::Error), #[error("HTTP response body error: {0}")] HttpResponseBodyError(reqwest::Error), #[error("Script element not found")] NoScriptError, #[error("Script processing error")] ProcessScriptError, #[error("JSON parsing error: {0}")] JsonParseError(#[from] serde_json::Error), #[error("No PlayItem")] NoPlayItemError, } Error handling (very robust, forces error checking) 1 2 3 4 5 6 7 8 9 10 let resp = req .send() .await .map_err(|e| InfoFetchError::SendHttpRequestError(e))? .error_for_status() .map_err(|e| InfoFetchError::HttpResponseError(e))?; let text = resp .text() .await .map_err(|e| InfoFetchError::HttpResponseBodyError(e))?; Pattern matching may have a bit of a learning curve, but it is very powerful once mastered.
TypeScript Configuration
tsconfig.json 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 { "include": ["src", "*.config.ts"], "exclude": ["dist", "node_modules"], "compilerOptions": { // Type Checking "strict": true, "allowUnreachableCode": false, "allowUnusedLabels": false, "exactOptionalPropertyTypes": true, "noFallthroughCasesInSwitch": true, "noImplicitOverride": true, "noImplicitReturns": true, "noPropertyAccessFromIndexSignature": true, "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, // Modules "types": ["vite/client"], "module": "esnext", "moduleResolution": "bundler", "allowImportingTsExtensions": true, "noUncheckedSideEffectImports": true, // Emit "noEmit": true, // JavaScript Support "allowJs": false, // Interop Constraints "erasableSyntaxOnly": true, "isolatedModules": true, "verbatimModuleSyntax": true, // Language and Environment "lib": ["ESNext", "DOM", "DOM.Iterable", "DOM.AsyncIterable"], "target": "esnext", // Completeness "skipLibCheck": true, }, } In addition, the official TS documentation does not recommend paths, but recommends Node Subpath Imports instead.
Use C++ Modules and import std
macOS + Clang Warning Clang version must be at least 19. Install tools 1 2 xcode-select --install brew install llvm cmake ninja Note
Shrink Docker WSL2 vhdx Disk Size
When using Docker Desktop with the WSL2 backend on Windows, the dynamic VHD disk (docker_data.vhdx) automatically grows as data is dumped. However, when you delete unused images or containers inside Docker, the host file does not shrink automatically. It is a common occurrence to see the .vhdx file bloated up to massive sizes like 130GB, even though the actual Docker usage is only a fraction of that. Core Solution: Directly Compact the VHDX The most effective way to reclaim your host machine disk space is to use the Windows diskpart tool to manually compact the bloated virtual disk file. Simply running docker system prune is not enough to shrink the container file on the host side.
Anxiety Over Social Control and Work
Recently, I have often been enveloped by an overwhelming sense of anxiety. The thought of young students being disciplined and “controlled” by society through the education system makes me deeply uncomfortable. The realization that upon adulthood, we seem destined to work for others, controlled and constrained, as if we are inevitably alienated into mere cogs in a colossal machine or slaves to the system, is incredibly suffocating. Even the thought of myself or my future partner facing this same fate fills me with an indescribable sorrow.
Peeling Back the Disguise of "Pure Friendship"
https://www.zhihu.com/question/1999285005235545066 “Why do all my male friends eventually confess their feelings to me? Is there really no pure friendship between men and women?” Before you throw this question into the void, hold off on feeling aggrieved. Accompanying such bewilderment, two vastly different extreme arguments often emerge online: one side criticizes men as being overly results-oriented, acting like machines that only care about efficiency and game theory; the other side mocks women for completely lacking boundaries and deliberately releasing “availability signals,” using “pure friendship” as a fig leaf to harvest emotional value.