Skip to content

Releases: JiangJie/happy-rusty

v1.9.2

12 Apr 15:27

Choose a tag to compare

[1.9.2] - 2026-04-12

Changed

  • Performance: Added /*#__PURE__*/ annotations to all top-level function call expressions for better tree-shaking support in consumer bundlers

Fixed

  • Build: Migrated treeshake config from deprecated 'smallest' string to object form for Vite 8 (Rolldown) compatibility
  • Build: Added topLevelVar: false to output options to preserve const declarations in bundled output

Chores

  • Upgraded devDependencies: vite, vitest, eslint, typedoc, typescript-eslint

Full Changelog: v1.9.1...v1.9.2

v1.9.1

16 Jan 03:27

Choose a tag to compare

[1.9.1] - 2026-01-16

Changed

  • Performance: Channel buffer replaced Array with Queue for O(1) shift operations

Documentation

  • Added @since tags to all public APIs
  • Improved JSDoc consistency and formatting

CI

  • Changed JSR publish to trigger on release instead of push to main

Full Changelog: v1.9.0...v1.9.1

v1.9.0

04 Jan 11:45

Choose a tag to compare

[1.9.0] - 2026-01-04

Added

  • Try Extensions for Result:
    • andTryAsync<U> - Like andThenAsync, but auto-catches exceptions/Promise rejections and converts them to Err
    • orTryAsync<F> - Like orElseAsync, but auto-catches exceptions in recovery logic

Changed

  • Performance: map() and mapErr() now return this when the Result variant doesn't match, avoiding unnecessary object creation

Removed

  • promiseToAsyncResult() - Use tryAsyncResult() instead (deprecated since v1.7.0)

Full Changelog: v1.8.0...v1.9.0

v1.8.0

31 Dec 08:47

Choose a tag to compare

[1.8.0] - 2025-12-31

Added

  • New Sync Primitives:
    • OnceAsync<T> - Async-first one-time initialization with concurrent call handling
    • RwLock<T> - Async read-write lock (multiple concurrent readers or single writer)
    • Channel<T> - MPMC (multi-producer multi-consumer) async message passing with optional bounded capacity
  • New Function Types:
    • FnOnce<A, R> - One-time callable sync function wrapper
    • FnOnceAsync<A, R> - One-time callable async function wrapper
  • New Methods:
    • Option.reduce() - Rust API alignment for reducing Option to its contained value
    • Result.intoOk() / Result.intoErr() - Infallible extraction for Result<T, never> and Result<never, E>
    • ControlFlow.intoValue() - Extract value when both branches have the same type
    • Once.tryInsert() / Once.waitAsync() - Additional initialization control
    • Mutex.get() / Mutex.set() / Mutex.replace() - Convenience methods
  • New Type Aliases:
    • SafeResult<T> - Result<T, never> for operations that cannot fail
    • AsyncSafeResult<T> - Async version of SafeResult
  • Iterator Protocol - Option and Result now implement Symbol.iterator for for...of loops:
    for (const value of Some(42)) { console.log(value); } // 42
    for (const value of None) { /* never executes */ }
  • Rust Documentation Links - All Rust-equivalent interfaces now link to official Rust docs via @see tags

Changed

  • Module Reorganization - Source code restructured into core/ (Option, Result) and std/ (sync, ops) directories, mirroring Rust's stdlib organization
  • Async Callback Types - All async methods now accept PromiseLike<T> | T instead of just Promise<T>, allowing mixed sync/async callbacks
  • Async Return Types - Use Awaited<T> to properly flatten nested Promises in async method return types
  • Internal Optimizations - Cached Promise constants (ASYNC_NONE, etc.) for better runtime performance

Fixed

  • this binding issue in Once.getOrTryInitAsync
  • Nested Promise flattening in async methods

Full Changelog: v1.7.1...v1.8.0

v1.7.1

26 Dec 03:55

Choose a tag to compare

[1.7.1] - 2025-12-26

Added

  • Argument passing - All try* functions now support passing arguments like Promise.try:
    • tryOption(JSON.parse, jsonString) instead of tryOption(() => JSON.parse(jsonString))
    • tryResult(decodeURIComponent, str) instead of tryResult(() => decodeURIComponent(str))
  • Unified sync/async returns - tryAsyncOption and tryAsyncResult now accept functions that return T | PromiseLike<T>, allowing mixed sync/async logic

Full Changelog: v1.7.0...v1.7.1

v1.7.0

25 Dec 16:19

Choose a tag to compare

[1.7.0] - 2025-12-26

Added

  • tryOption() - Capture synchronous exceptions as Option (success → Some, exception → None)
  • tryAsyncOption() - Capture async/Promise exceptions as Option
  • tryResult() - Capture synchronous exceptions as Result (success → Ok, exception → Err)
  • tryAsyncResult() - Capture async/Promise exceptions as Result

Deprecated

  • promiseToAsyncResult() - Use tryAsyncResult() instead (same functionality, more consistent naming)

Full Changelog: v1.6.2...v1.7.0

v1.6.2

25 Dec 03:09

Choose a tag to compare

[1.6.2] - 2025-12-25

Changed

  • promiseToAsyncResult now accepts PromiseLike<T> instead of Promise<T> for broader compatibility with thenable objects
  • Use AsyncResult type alias in function signatures for consistency

Removed

  • Removed unused source field from package.json (Parcel legacy)
  • Removed redundant @internal tags from private (non-exported) functions

Full Changelog: v1.6.1...v1.6.2

v1.6.1

19 Dec 03:04

Choose a tag to compare

[1.6.1] - 2025-12-19

Changed

  • License changed from GPL-3.0 to MIT for broader adoption and easier integration

Added

  • Navigation links (GitHub, npm, JSR) in TypeDoc documentation header

Full Changelog: v1.6.0...v1.6.1

v1.6.0

18 Dec 14:09

Choose a tag to compare

[1.6.0] - 2025-12-18

Added

  • Sync Primitives: Once<T>, Lazy<T>, LazyAsync<T>, Mutex<T> for Rust-style synchronization
  • Control Flow: ControlFlow<B, C> with Break and Continue variants
  • Symbol.toStringTag property to all types for better type identification
  • Custom toString() method to all types for debugging
  • isControlFlow() type guard utility
  • isNoneOr() and isNoneOrAsync() methods for Option
  • exports field in package.json for modern Node.js module resolution
  • GitHub Pages workflow for automatic API documentation deployment
  • Immutability tests to verify Object.freeze() is working correctly
  • 100% test coverage
  • CHANGELOG.md with full version history

Changed

  • All instances are now frozen with Object.freeze() for runtime immutability
  • TypeDoc output format from Markdown to HTML for GitHub Pages compatibility
  • Migrated from Deno test to Vitest
  • Build process split into Vite (JS) and Rollup (dts)

Fixed

  • Symbol property syntax and duplicate declaration issues
  • Type inference improvements for None interface methods

Full Changelog: v1.5.0...v1.6.0

v1.5.0

11 Aug 10:18

Choose a tag to compare

Full Changelog: v1.4.0...v1.5.0