Skip to content

Releases: illuxiza/ts-rustable

v0.4.0

30 Jan 06:50
Compare
Choose a tag to compare

Rustable v0.4.0 Release Notes

A TypeScript Revolution: Rust-Like Safety, Performance, and Expressiveness


🚀 New Features

Core Type System & Utilities

  • New @rustable/type Package:
    ✨ Dedicated type factories and derivation system
    ✨ Proxy-based factory implementation with enhanced caching

  • Enhanced Collections:
    IdxVec: Indexed array type with optimized operations
    HashMap/HashSet:

    • New Entry API with and_modify()/or_insert() patterns
    • Set operations: intersection(), union(), difference()
      Vec:
    • JSON serialization via toJSON()/toString()
    • Renamed methods for Rust consistency:
      vec.sortByKey()  vec.sortBy()  
      vec.unstableSort()  vec.sortUnstable()  
  • Async & Error Handling:
    Result.fromAsync() for promise-to-Result conversion
    Result.fromFn() for safe function execution
    NotImplementedError replacing legacy error constants


Revamped Trait System (@rustable/trait)

  • New Trait Base Class :

    class Display extends Trait {
      display(): string { return "default"; }
    }
    
    // Implementation
    Display.implFor(Point, { 
      display() { return `(${this.x}, ${this.y})` } 
    });
    
    // Usage
    const point = new Point(1, 2);
    const display = Display.wrap(point); // Zero-overhead wrapper
    console.log(display.display()); // "(1, 2)"
  • Key Methods:
    isImplFor() – Type-safe trait checking
    staticWrap() – Static method trait support
    tryImplFor() – Idempotent trait registration
    ✨ Dedicated errors (TraitMethodNotImplementedError)

  • Performance:
    🚀 40% faster trait resolution via direct inheritance
    🚀 Zero proxy overhead for implemented traits


Iterator Ecosystem (@rustable/iter)

  • Advanced Modules:
    num_iter: sum, product
    partition_iter: In-place collection partitioning
    ✨ Merged operations: filter_map, flat_map, skip

  • Consistency Renames:

    iter.maxByKey()  iter.maxBy()  
    iter.sortByKey()  iter.sortBy()  

💥 Breaking Changes

API Changes

  • Trait System:
    ❗ Removed global functions: hasTrait/implTrait/useTrait
    ❗ Legacy TraitWrapper replaced by Trait inheritance

    // Before (v0.3.x)
    @trait
    class Display { ... }
    implTrait(Point, Display);
    
    // After (v0.4.0)
    class Display extends Trait { ... }
    Display.implFor(Point, ...);
  • Collections:
    Vec index operations moved to IdxVec
    Enum.equals() renamed to Enum.eq()

  • Packages:
    ❗ Type system utils moved to @rustable/type (update imports!)
    ❗ Iterators split into core and advanced modules:

    import "@rustable/iter/advanced";

⚡ Performance Highlights

  • Trait System:
    🚀 2.1x faster checks via inheritance-based resolution
    🚀 60% memory reduction in trait registration

  • Collections:
    🚀 Vec.sortUnstable() now 35% faster for large datasets
    🚀 Val primitive wrappers have zero runtime overhead

  • Tree-Shaking:
    🚀 All packages marked "sideEffects": false


📚 Documentation & DevEx

  • Enhanced READMEs:
    📘 Emoji-driven feature sections
    📘 Cross-package consistency in examples
    📘 Advanced iterator usage guides

  • Error Handling:
    📝 Clear OUT_OF_BOUNDS errors for collections
    📝 Stack traces with Location context


🛠️ Migration Guide

  1. Update Dependencies:

    npm install @rustable/[email protected] @rustable/[email protected] ...
  2. Trait System Migration:

    - @trait
    - class Display { ... }
    + class Display extends Trait { ... }
    
    - implTrait(Point, Display, impl);
    + Display.implFor(Point, impl);
  3. Collection Updates:

    - vec.unstableSort(...);
    + vec.sortUnstable(...);
    
    - import { Type,TypeId, createFactory } from "@rustable/utils";
    + import { Type,TypeId, createFactory } from "@rustable/type";

Rustable: Bringing Rust's reliability to TypeScript with zero compromises. 🦀

v0.3.8

08 Jan 09:37
Compare
Choose a tag to compare

v0.3.8

Added

🚀 Enhanced Trait System

  • Added support for generic type inheritance in trait implementation
  • Improved trait detection for generic containers
  • Enhanced type checking for trait-to-trait implementations

🛠️ Build & CI

  • Added GitHub Actions workflow for automated npm package publishing
  • Configured Yarn 4.6 for CI environment

Changed

🔄 Type System Improvements

  • Improved prototype chain handling in Type decorator
  • Enhanced useNormal and useStatic to handle generic type inheritance
  • Optimized trait implementation storage for better type safety

📦 Package Updates

  • Migrated test framework from Jest to Vitest
  • Updated package versions across all packages
  • Simplified Type implementation

Fixed

🐛 Bug Fixes

  • Fixed static method binding in trait implementations
  • Improved error message formatting for generic trait names
  • Fixed trait detection for generic containers

Documentation

📚 Updates

  • Enhanced README with detailed feature descriptions
  • Added comprehensive documentation for trait and utils packages
  • Improved API documentation and examples

v0.2.9

30 Dec 10:50
Compare
Choose a tag to compare

v0.2.9

Documentation

  • enum: Enhanced documentation for custom enums with Enums.create
    • Added comprehensive usage examples with type-safe variants and parameters
    • Included type definition examples and best practices
    • Added pattern matching and variant checking demonstrations
    • Provided code snippets for common use cases

Bug Fixes

  • utils: Fixed infinite recursion issue in deepClone for objects with clone method
    • Added object tracking using WeakMap to prevent infinite recursion
    • Implemented proper cleanup using try-finally block
    • Ensures cloning state is always removed after operation
    • Improved handling of objects implementing custom clone methods

For more details, please refer to the commit history.

v0.2.7

29 Dec 09:49
Compare
Choose a tag to compare

v0.2.7

New Features

Vector Enhancements

  • Added append method for vector concatenation
  • Added reverse method for reversing vector elements

Enum System Improvements

  • Added Enums.create() for dynamic enum creation with custom variants
  • Introduced type-safe variant check methods (isA(), isB(), etc.) for better IDE support
  • Added clone support with deep cloning of variant arguments
  • Made enum constructors public
  • Renamed equals() to eq() for better Rust alignment
  • Enhanced modify() method with more flexible error handling

Optimizations & Refactoring

Trait System

  • Optimized parent trait collection and type inference
  • Reordered static trait implementation before method checks
  • Improved trait implementation lookup to include inherited methods

HashMap Improvements

  • Refactored iterator implementation to use index-based bucket traversal
  • Changed #keysEqual from private field to private method for better encapsulation

This release series brings significant improvements to the collections and trait system, with a focus on enum functionality, better type safety, and performance optimizations.

v0.2.1

27 Dec 04:49
Compare
Choose a tag to compare

v0.2.1

Added

  • New Ref type in @rustable/utils for immutable references
    • Deep cloning of original values
    • Independent modifications without affecting originals
    • Symbol-based access to original values via Ref.ptr
    • Full support for complex objects, arrays, and class instances
    • Comprehensive test coverage

Changed

  • Reimplemented Mut in @rustable/utils as proxy-based mutable reference
    • Replaced class-based implementation with Proxy for transparent object mutation
    • Added Symbol-based pointer (Mut.ptr) for full object replacement
    • Improved direct property access and method binding
    • Enhanced type safety and object property access
    • Added extensive test cases for new proxy behavior

Documentation

  • Added detailed examples and usage guides for both Ref and Mut
  • Updated API documentation with new features and patterns
  • Improved code samples demonstrating common use cases

v0.2.0

27 Dec 02:13
Compare
Choose a tag to compare

v0.2.0

This release focuses on consolidating packages and enhancing the trait system for better usability and maintainability.

Breaking Changes

  • Renamed @rustable/trait-impls to @rustable/commons
  • Merged @rustable/coll into @rustable/commons
  • All collection and trait implementations are now available through @rustable/commons

Features & Improvements

Trait System

  • Improved generic parameter handling and inheritance
  • Fixed method binding for Object prototype methods
  • Added global type declarations for common traits
  • Updated all imports from trait-impls to commons

Collections

  • Moved all collection implementations (HashMap, HashSet, Vec) to commons
  • Maintained all existing collection features and type safety
  • Better integration with trait system

Enum Package

  • Added replace() and modify() methods for variant manipulation

Package Structure

  • Simplified by combining related functionality
  • Better organized exports in root package
  • Added @rustable/enum as direct dependency of commons
  • Improved package descriptions and documentation

This release represents a significant step in streamlining the library's architecture while maintaining all functionality and type safety.

v0.1.7

22 Dec 12:41
Compare
Choose a tag to compare

v0.1.7

Features

  • trait: Add trait-to-trait implementation support

    • Traits can now implement other traits
    • Automatic inheritance of trait implementations
    • Added comprehensive test suite for trait-to-trait implementations
  • enum/Result:

    • Remove Error constraint from Result type for broader usage
    • Add mapOr method for convenient value mapping with default
  • coll/HashSet:

    • Add extend method to support bulk insertion from iterables

Breaking Changes

  • enum/Result: The E type parameter in Result<T, E> no longer requires extending Error. If you were relying on Error methods in your error handling, you'll need to add the constraint in your implementation.

v0.1.6

18 Dec 02:27
Compare
Choose a tag to compare

v0.1.6

Major Features

Vec Enhancements

  • Added proxy-based index access support (e.g. vec[0]) for array-like operations
  • Added global vec() function for convenient Vec creation
  • Enhanced bounds checking for all index-based operations
  • Added splice method for array-like element manipulation
  • Enhanced drain and drainBy to return Vec instead of iterator

Collection Improvements

HashMap/HashSet

  • Added Entry API for efficient key-value manipulation
  • Enhanced Entry API with modify, replaceWith, and remove operations
  • Added orInsertWithKey functionality for conditional insertions
  • Improved edge case handling for deletion operations

Trait System Enhancements

  • Added support for static trait methods
  • Refactored trait system to handle both instance and static methods
  • Improved type safety for trait implementations
  • Enhanced Default trait with static method support
  • Refactored From trait to use static methods

v0.1.5

13 Dec 03:45
Compare
Choose a tag to compare

v0.1.5

New Features

Mut Class for Mutable References

  • Introduced the Mut class to provide a type-safe way to handle mutable references
  • Mut encapsulates getter and setter functions for flexible value access and modification

Enhanced Vec Methods

  • Implemented set method for direct value assignment at a specific index
  • Added getMut method to obtain a mutable reference to an element
  • Introduced replaceWith method for replacing an element with a new value

v0.1.3

12 Dec 11:50
Compare
Choose a tag to compare

v0.1.3

Improvements

  • Optimized the return type definition of the iter trait for better performance and clarity.
  • Enhanced the README of the rustable package to provide clearer instructions and examples for users.