Expand description
§Corlib
X | Twitch | Youtube | Mastodon | GitHub | GitHub Sponsors
Corlib is a various ideas library.
§Library Contents:
§NonOption
Like an option but not optional.
§Immut
Forces external immutability.
§WorkInProgressResult And IdedWorkInProgressResult
Containers used for communicating the results and statuses of ongoing operations.
§GapFillingCounter
A counter that can recycle “gaps”.
§Getter Setter Caller Macros
Macros for implementing getters, setters and calling methods on regular structs and RefCells.
§Get Some
Convert Options into certainty.
§Sub-Modules:
§Cell
Macros, functions and the RefCellStore which help make working with RefCells easier.
§Collections
Collections and collection related objects.
§Convert
Convert stuff into &dyn Any and &mut dyn Any.
§Drop Panic
A fun way to crash your programme.
§Events
Events and event related objects.
Loosely inspred by .NET events.
§Has One
Get the value of one for each numeric type.
§Inc Dec
Miss the ++ and -- operators?
This module can help sort you out.
§Rc
Reference counting related helper structs and traits.
§Text
Look at SendableText and AsStr.
§Upgrading
Functions that help you deal with upgrading reference counted objects.
§Value
For when you want to move values around.
§Compiler:
Build with the latest stable compiler.
§Todo:
- Add more documentation
- Add code examples
- Add more tests
- Clean-up the code
- 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:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 (see also: https://www.tldrlegal.com/license/apache-license-2-0-apache-2-0))
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT (see also: https://www.tldrlegal.com/license/mit-license))
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.
Modules§
- cargo_
env - This module mostly contains functions that return cargo environment variables.
- cell
- The items in this module help you work with RefCells.
- collections
- Collection related stucts and traits, some of which are inspired by .NET.
- convert
- Convert stuff into &dyn Any and &mut dyn Anys.
- drop_
panic - A fun way to crash your programme.
- events
- Event structs loosely inspired by .NET events.
- has_one
- Trait implenenations for getting the value of one for each numeric type.
- inc_dec
- This module enables you to do ++ and – like operations on standard numeric primitives.
- rc
- Reference counting related helper structs and traits.
- text
- Do stuff with text.
- upgrading
- Functions that help you deal with upgrading reference counted objects.
- value
- For when you want to do stuff with values and generic type constraints.
Macros§
- checked_
mm_ mut - Calls checked_sub on an integer with 1 as a parameter.
- checked_
pp_ mut - Calls checked_add on an integer with 1 as a parameter.
- get_
some - Takes one or more Option enum objects and returns the taken objects from those Options, panicking with “Error: Nothing here!” if at least one object isn’t found.
- impl_
aliased_ get_ mut - impl_
aliased_ get_ mut_ 2 - impl_
aliased_ get_ ref - impl_
aliased_ get_ ref_ 2 - impl_
aliased_ get_ ref_ mut_ 2 - impl_
as_ any_ mut - impl_
as_ any_ mut_ method - impl_
as_ any_ ref - A macro for implementing the AsAnyRef trait.
- impl_
as_ any_ ref_ method - impl_
cargo_ env_ accessor - impl_
cargo_ env_ accessor_ pair - impl_
get Deprecated - impl_
get_ 2 Deprecated - impl_
get_ 2_ set Deprecated - impl_
get_ mut - impl_
get_ mut_ 2 - impl_
get_ ref - impl_
get_ ref_ 2 - impl_
get_ ref_ mut_ 2 - impl_
get_ set Deprecated - impl_
get_ set_ 2_ ref_ mut_ 2 - impl_
pub_ single_ sub_ args_ event_ method - Generates a method that enables convenient access to the result of a pub_this call on a SingleSubArgsEvent.
- impl_
pub_ single_ sub_ event_ method - Generates a method that enables convenient access to the result of a pub_this call on a SingleSubEvent.
- impl_
rfc_ borrow - impl_
rfc_ borrow_ 2 - impl_
rfc_ borrow_ aliased_ call - impl_rfc_borrow_call with an an aliased method name.
- impl_
rfc_ borrow_ and_ mut_ 2 - impl_
rfc_ borrow_ call - Calls borrow on a RefCelled field and calls a method on the returned Ref. Don’t try to return a reference though (It wont work).
- impl_
rfc_ borrow_ get - impl_
rfc_ borrow_ get_ 2 - impl_
rfc_ borrow_ mut - impl_
rfc_ borrow_ mut_ 2 - impl_
rfc_ borrow_ mut_ aliased_ call - impl_rfc_borrow_mut_call with an an aliased method name.
- impl_
rfc_ borrow_ mut_ call - Calls borrow_mut on a RefCelled field and calls a method on the returned RefMut. Don’t try to return a reference though (It wont work).
- impl_
rfc_ borrow_ mut_ get_ set_ 2 - impl_
rfc_ borrow_ mut_ set - impl_
rfc_ borrow_ mut_ set_ 2 - impl_
rfc_ borrow_ mut_ subscribe - Subscribe to an event through a RefCell.
- impl_
rfc_ borrow_ mut_ subscription - Subscribe and unsubscribe to an event through a RefCell.
- impl_
rfc_ borrow_ mut_ unsubscribe - Unsubscribe to an event through a RefCell.
- impl_
set - impl_
set_ 2 - impl_
weak_ self_ trait - This macro helps you implement the weak-self design pattern.
- mm
- Decrements the provided integer by one.
- mm_mut
- Decrements the provided integer by one and returns it.
- mmf
- Decrements the provided floating point number by one.
- mmf_mut
- Decrements the provided floating point number by one and returns it.
- omm_mut
- Calls overflowing_sub on an integer with 1 as a parameter.
- opp_mut
- Calls overflowing_add on an integer with 1 as a parameter.
- pp
- Increments the provided integer by one.
- pp_mut
- Increments the provided integer by one and returns it.
- ppf
- Increments the provided floating point number by one.
- ppf_mut
- Increments the provided floating point number by one and returns it.
- rfc_
borrow - Intended to be used with a std::cell:RefCell that is a field of $this.
- rfc_
borrow_ 2 - Like rfc_borrow but for situations where it is intended that $this be copied i.e. where $this is already a reference.
- rfc_
borrow_ mut - Intended to be used with a std::cell:RefCell that is a field of $this.
- rfc_
borrow_ mut_ 2 - Like rfc_borrow_mut but for situations where it is intended that $this be copied i.e. where $this is already a reference.
- trait_
get Deprecated - trait_
get_ 2 Deprecated - trait_
get_ 2_ set Deprecated - trait_
get_ mut - trait_
get_ mut_ 2 - trait_
get_ ref - trait_
get_ ref_ 2 - trait_
get_ ref_ 2_ mut_ 2 - trait_
get_ set Deprecated - trait_
get_ set_ 2_ ref_ mut_ 2 - trait_
get_ weak_ self_ ref - trait_
rfc_ borrow - trait_
rfc_ borrow_ 2 - trait_
rfc_ borrow_ and_ mut_ 2 - trait_
rfc_ borrow_ mut - trait_
rfc_ borrow_ mut_ 2 - trait_
set - wmm_mut
- Calls wrapping_sub on an integer with 1 as a parameter.
- wpp_mut
- Calls wrapping_add on an integer with 1 as a parameter.
Structs§
- GapFilling
Counter - Increments a number returning “gap” mumbers, numbers that are reported to be no longer “be in use”, first.
- Ided
Work InProgress Result - A WorkInProgressResult with an id.
- Immut
- This object makes its contained object externally immutable only.
- NonOption
- An Option that is not really optional (but is still kinda). Start by creating the object by calling invalid (probably as a field in a struct constructor) and setting a value by calling “set” with a parameter as soon as possible. Attempting to use an invalid NonOption will cause a panic, so make absolutely sure you’ve set it with a value before calling “get_ref”, “get_mut” etc.
- Work
InProgress Result - For indicating when some work has been done or is in the process of being done, potentially being accompanied by a result object.
Traits§
- Weak
Self - This trait is useful when implementing the weak-self design pattern.