2 unstable releases

0.2.0 Apr 18, 2024
0.1.0 Jul 20, 2023

#306 in Rust patterns

Download history 3/week @ 2024-02-10 13/week @ 2024-02-17 21/week @ 2024-02-24 10/week @ 2024-03-02 20/week @ 2024-03-09 14/week @ 2024-03-16 31/week @ 2024-03-23 44/week @ 2024-03-30 16/week @ 2024-04-06 160/week @ 2024-04-13 16/week @ 2024-04-20

240 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

150KB
4K SLoC

Corlib

Crates.io License Downloads Docs Twitch Status

X | Twitch | Youtube | Mastodon | GitHub | GitHub Sponsors

Corlib is a various ideas library.

Library Contents:

NonOption

Like an option but not optional.

RcByPtr and WeakByPtr

Compare and hash an Rc and Rc::Weak objects by pointer instead of by value.

RcDefault and ArcDefault

Default traits for returning reference counted types.

MovableText

For conveniently moving owned and static strings around.

AsStr

A trait with an as_str method.

Droppers

Structs for caling closures on drop.

GapFillingCounter

A counter that can recycle "gaps".

Get Rc Or Weak Self

Traits and macros to support the Weak-Self pattern (deprecated).

Get Ref Mut

Traits for getting references (deprecated).

Getters Setters Callers

Macros for implementing getters, setters and calling stuff (mostly deprecated).

HasOne

Sometimes you just want the value 1 (or 1.0).

Invalid

A trait for implenting a method that returns an invalid instance of Self (deprecated).

Lazy

A struct for lazily initalising objects.

Does not contain its own initalising closure.

As Any

A trait with a method (as_any) for returning a &dyn Any instance of &self (comes with a handy implementation macro).

Get Some

Convert Options into certainty.

Inc Dec

Miss the ++ and -- operators?

This module can help sort you out.

Collections

Collections and collection related objects.

Events

Events and event related objects. Inspred by .net events.

Sync

Objects for synchronising stuff.

Todo:

  • Add more documentation
  • Add code examples
  • Add some tests
  • Add Hashmap and Hashset based event implementations
  • Code cleanup
  • Solidify the API for 1.0

Coding Style

This project uses a coding style the emphasises the use of white space over keeping the line and column counts as low as possible.

So this:

fn foo()
{

    bar();

}

Not this:

fn foo()
{
    bar();
}


License

Licensed under either of:

at your discretion


Contributing

Please clone the repository and create an issue explaining what feature or features you'd like to add or bug or bugs you'd like to fix and perhaps how you intend to implement these additions or fixes. Try to include details though it doesn't need to be exhaustive and we'll take it from there (dependant on availability).


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~300–760KB
~18K SLoC