sain

a set of abstraction of Rust's core crates for Python 🦀

BSD-3-CLAUSE License

Downloads
1.3K
Stars
0

Bot releases are visible (Hide)

sain - 1.2.0 Latest Release

Published by nxtlo about 1 month ago

Added

  • sain.collections.HashMap
  • Bytes.chars
  • Bytes.as_ptr
  • Iterator.collect_into
  • Option.insert
  • Option.get_or_insert
  • Option.get_or_insert_with
  • Option.ok_or
  • Option.ok_or_else
  • Option.zip
  • Option.zip_with
  • Option.inspect

Changed

  • Improved performance by removing nothing_unchecked calls from methods that return Option[T] by replacing with NOTHING constant.
  • MaybeUninit no longer exported to top level.
  • Option.into_inner renamed to Option.transpose
  • Lazy and LazyFuture now take a closure that initialize the value at first access
    instead of calling .set manually.
  • Renamed Bytes.as_bytes to Bytes.to_bytes

Removed

  • Option.as_ref
  • Option.as_mut
  • Cell and RefCell
sain - 1.1.0

Published by nxtlo 4 months ago

Added

  • conversion interfaces Into, From, TryInto and TryFrom.
  • count, index and sort methods to Vec.
  • macos alias to darwin for target_os.
  • ios support to target_os.
  • impl Bytes

Changed

  • starting from this release, all collections are moved to collections instead of being in top-level.
    of course, core implementations such as Vec are still at top level.
sain - 1.0.0

Published by nxtlo 4 months ago

Added

  • MaybeUninit[T] type.
  • Iterator interface which represents Iterator trait in Rust
  • Default external adapters for Iterator.
  • Vec.push_within_capacity
  • Vec.reserve
  • Some.take_if
  • iter.repeat

Changed

  • Option.take now return Option[T] instead of None
  • Stabilized Vec.with_capacity and its fellow methods.
  • Calling RefCell.copy now increment its ref count when called.
  • The repr of Some(None) is now None instead of Some(None)
  • Passing a list variable when constructing a Vec now will point to that list instead of copying it.
  • Better documentation on Vec
  • vec.vec is renamed to vec.from_args
  • iter.empty now returns Empty[T] instead of Iter[Never] with better type hinting.
  • Better repr for iterators.
  • Changed the default value of Some from NoneType to Some(None)
sain - 0.0.6

Published by nxtlo 6 months ago

Added

  • @doc decorator.
  • The Result type including OK and Err.
  • Vec[T] type.
  • Error type.
  • Box[T] type. This is not the same as rust's Box, Check the object documentation.
  • sync package which contains the following modules. they're object safe.
    • lazy.Lazy[T] and lazy.LazyFuture[T].
    • once.AsyncOnce[T] and once.Once[T].
  • Iter.sink method.
  • RefCell received two methods, increment and decrement which increments the ref count of the object its holding.

Changed

  • Iterating over Iter object with for doesn't return Option[T] anymore.
  • Type hint Option isn't required to be under TYPE_CHECKING anymore.
  • futures.spawn now returns Result[T, E] and doesn't raise.
  • Iter.async_for_each now returns Result[T, E] and doesn't raise.
  • ref.AsRef is now cell.Cell, ref.AsMut is now cell.RefCell.
sain - 0.0.5

Published by nxtlo 9 months ago

Added

  • Once type.
  • Iter.next now returns sain.Option[T] instead of typing.Optional[T].
  • .copied, by_ref, .async_for_each methods to the Iter.
  • empty function in sain.iter module.
  • once function in sain.iter module.
  • Some.__iter__ and Some.iter methods to the Some object.
  • option.NOTHING default constant.

Removed

  • method Iter.discard in favor of Iter.filter method.

Changed

  • casting parameter in Iter.collect renamed to cast.
sain - 0.0.4

Published by nxtlo about 1 year ago

Added

  • New decorators defined in module macros.py
    • todo
    • unimplemented
    • deprecated
  • futures module which exports usefull functions for async programming.
  • Some.unwrap_unchecked method.

Changed

  • Python 3.10+ is now required to install sain.
  • Use the collections.abc and builtins for the standard types.
  • You need to import __futures__ annotations to use Option<T> type hint, You also need to import it under TYPE_CHECKING.
  • Project tree restructure.
  • The Drop check is now deprecated and no longer can be used.
  • The standard types not do not inherit from Default<T>
  • Drop pkg_resources module for __import__ during requires_modules attrs check..

Removed

  • The Drop protocol from top-level.
sain - 0.0.3

Published by nxtlo over 2 years ago

Added

  • Examples
  • Proper documentation.
  • Drop protocol and drop function.
  • RefMut type and as_mut.
  • Tests
  • Default is now slotted
  • .pyi stubs.

Changed

  • The Some type __str__ now returns Some(repr(value)) instead of just repr(value).
  • Ref now supports __hash__.
  • target_os no accepts windows as an alias to win32.

Removed

  • Some.is_none_and method since it made no sense.

Fixed

  • sain.cfg() wasn't working correctly.
sain - 0.0.2

Published by nxtlo over 2 years ago

0.0.2

Addeed

  • A type alias Option[T] for Some[T].

Changed

  • Export modules to top level.
sain - First release.

Published by nxtlo over 2 years ago

0.0.1

Added

  • First push
  • Added target arch + python impl options.
  • Some[T], Default[T], Ref[T], Iter[T] types.

Changed

  • requires_modules option now accepts a sequence instead of tuple.

Removed

Fixed

  • Fixed a bug where cfg was always returning True.