Skip to content

Object safe collections and iterables are defined in obj_safe module

Latest
Compare
Choose a tag to compare
@orxfun orxfun released this 09 Dec 20:39
· 2 commits to main since this release
630e904

Object safe variants IterableObj, CollectionObj and CollectionMutObj are introduced in obj_safe module.

  • Conditions to implicitly implement the object safe traits are identical to the original. Therefore, if a type implements, say Collection, it also implements CollectionObj; and vice versa.
  • Due to this equivalence, all iterable-to-iterable transformation methods work in the same manner as they work for original traits.
  • Instead of iter and iter_mut, object safe variants have boxed_iter and boxed_iter_mut methods which return iterators in a box.
  • In order to use them "std" feature must be activated. Standard library is optional; however, added in the default feature.
  • However, object safe variants are not imported from the root module. In other words, we don't have access to them if we use orx_iterable::*. This is intentional to keep the api cleaner unless we explicitly require trait objects. In order to use them, we can instead import by orx::iterable::{*, obj_safe::*}.