Crate enso_prelude[−][src]
Expand description
This module re-exports a lot of useful stuff. It is not meant to be used by libraries, but it is definitely usefull for bigger projects. It also defines several aliases and utils which may find their place in new libraries in the future.
Re-exports
pub use paste; | |
pub use weak_table; |
Modules
at_least_one_of_two | Definition of |
fmt | Utilities for formatting and printing |
iter | Composable external iteration. |
mem | Basic functions for dealing with memory. |
monoid | A class for monoids (types with an associative binary operation that has an identity) with various general-purpose instances. |
non_empty_vec | This file contains an implementation of Vec that can’t be empty. |
semigroup | In mathematics, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. A semigroup generalizes a monoid in that there might not exist an identity element. It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, thus the name semigroup. |
slice | A dynamically-sized view into a contiguous sequence, |
Macros
Debug | Derive macro generating an impl of the trait |
Hash | Derive macro generating an impl of the trait |
alias | |
clone_boxed | |
enclose | Macro for cloning values to close. |
f | Clones all arguments from the first argument list by using |
f_ | Variant of the |
f__ | Variant of the |
ieprint | Print an |
ieprintln | Print an |
iformat | Creates a String by interpolating inlined expressions. Takes one argument, which must be a string literal. |
iformat_args | Create a |
im_string_newtype | Defines a newtype for |
impl_clone_ref_as_clone | |
impl_clone_ref_as_clone_no_from | |
impls | Allows for nicer definition of impls, similar to what Haskell or Scala does. Reduces the needed boilerplate. For example, the following usage: |
ipanic | Panic with an |
iprint | Print an |
iprintln | Print an |
iwrite | Print an |
iwriteln | Print an |
lazy_static | |
unreachable_panic | A macro for use in situations where the code is unreachable. |
Structs
Anything | Placeholder type used to represent any value type. It is useful to define type-level relations like defining an unit with any quantity, let it be distance or mass. |
BTreeMap | A map based on a B-Tree. |
Cell | A mutable memory location. |
CloneCell | |
CloneRefCell | |
CowString | A copy-on-write String implementation. It is a newtype wrapper for |
DefaultHasher | The default |
False | Type level |
HashMap | A hash map implemented with quadratic probing and SIMD lookup. |
HashSet | A hash set implemented as a |
ImString | Immutable string implementation with a fast clone implementation. |
Immutable | A zero-overhead newtype which provides immutable access to its content. Of course this does not apply to internal mutability of the wrapped data. A good use case of this structure is when you want to pass an ownership to a structure, allow access all its public fields, but do not allow their modification. |
NonEmptyVec | A version of |
PhantomData | Zero-sized type used to mark things that “act like” they own a |
Range | A (half-open) range bounded inclusively below and exclusively above
( |
RangeFrom | A range only bounded inclusively below ( |
RangeFull | An unbounded range ( |
RangeInclusive | A range bounded inclusively below and above ( |
RangeTo | A range only bounded exclusively above ( |
RangeToInclusive | A range only bounded inclusively above ( |
Rc | A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’. |
Ref | Wraps a borrowed reference to a value in a |
RefCell | A mutable memory location with dynamically checked borrow rules |
RefMut | A wrapper type for a mutably borrowed value from a |
SmallVec | A |
Switch | The |
TraceCopies | An utility for tracing all copies of CloneRef-able entity. |
True | Type level |
Weak |
|
WeakKeyHashMap | A hash map with weak keys, hashed on key value. |
WeakValueHashMap | A hash map with weak values. |
WithPhantom | A wrapper adding a phantom type to a structure. |
Enums
AtLeastOneOfTwo | A struct similar to |
Cow | A clone-on-write smart pointer. |
Traits
Add | The addition operator |
Any | A trait to emulate dynamic typing. |
AsOwned | The owned version of a type. It would be super cool if Rust would allow us to automatically
implement it for every type: |
Boolinator | This trait defines a number of combinator-style methods for use with |
CellGetter | Generalization of the |
CellProperty | Generalization of modify utilities for structures similar to |
CellSetter | Generalization of the |
CloneRef | Clone for internal-mutable structures. This trait can be implemented only if mutating one
structure will be reflected in all of its clones. Please note that it does not mean that all the
fields needs to provide internal mutability as well. For example, a structure can remember it’s
creation time and store it as |
ClonedRef | Trait for types that can be internally cloned using |
ContentRef | Unwrapping utility for wrapped types. |
Debug |
|
Deref | Used for immutable dereferencing operations, like |
DerefMut | Used for mutable dereferencing operations, like in |
Display | Format trait for an empty format, |
Div | The division operator |
Fail | The |
FromIterator | Conversion from an |
HasContent | Trait for any type which wraps other type. See docs of |
HasItem | Type family for structures containing items. |
HasRefValue | |
Hash | A hashable type. |
Hasher | A trait for hashing an arbitrary stream of bytes. |
Index | Used for indexing operations ( |
IndexMut | Used for indexing operations ( |
Itertools | An |
KnownTypeValue | Defines relation between types and values, like between |
Monoid | Mutable Monoid definition. |
Mul | The multiplication operator |
Neg | The unary negation operator |
Num | The base trait for numeric types, covering |
OptionOps | Adds mapping methods to the |
PartialSemigroup | Mutable Semigroup definition. Impls should satisfy the associativity law:
|
PhantomConversions | A utility for easy driving of type-level computations from value level. Often we’ve got some
type level relations, like a few singleton types, and for each such type we’ve got an associated
value. For example, we can define types |
RangeBounds |
|
RefCellOptionOps | |
ResultOps | Adds utilities to the |
ResultUnwrapBoth | |
Semigroup | |
SliceIndex | A helper trait used for indexing operations. |
SmallVecOps | Adds methods to the |
StringOps | |
StrongRef | Abstraction for a strong reference like |
Sub | The subtraction operator |
ToImpl | Provides method |
ToRef | Similar to |
TryFrom | Simple and safe type conversions that may fail in a controlled
way under some circumstances. It is the reciprocal of |
TryInto | An attempted conversion that consumes |
TypeDisplay | Like |
Unwrap | Unwraps the content by consuming this value. |
VecOps | |
WeakElement | Interface for elements that can be stored in weak hash tables. |
WeakKey | Interface for elements that can act as keys in weak hash tables. |
WeakOps | Mapping methods to the |
WeakRef | Abstraction for a weak reference like |
WithContent | Runs a function on the reference to the content. |
Wrap | Wrapping utility for values. |
Functions
Immutable | Constructor of the |
backtrace | Print the current backtrace. |
content | Provides reference to the content of this value. |
default | Alias for |
identity | The identity function. |
type_display | Formats the type for the user-facing output. |
type_name | Returns the name of a type as a string slice. |
unwrap | Unwrap the content by consuming this value. |
with | Surprisingly useful function. Consider the following code: |
wrap | Wraps the value and returns the wrapped type. |
Type Definitions
Content | Accessor for the wrapped value. |
Owned | Owned type family. |
PhantomData2 | The following |
PhantomData3 | |
PhantomData4 | |
PhantomData5 | |
PhantomData6 | |
PhantomData7 | |
PhantomData8 | |
PhantomData9 | |
RefValue | |
TypeValue |
Derive Macros
CloneRef | Derives |
Derivative | |
Fail | |
Shrinkwrap |
Trait aliases
BiInto | Can be transformed from and into. |
HasSizedContent | Trait which enables |
IntoOwned | Converts type to its owned version. |
IntoSelfFrom | This is used to make type inference better at use sites - without it,
Rust would force one to write the |
ItemClone | |
PhantomInto | Like |
RefInto | Alias for |
Str | Abstraction for any kind of string as an argument. Functions defined as
|
Wrapper | Trait for objects which wrap values. Please note that this implements safe wrappers, so the object - value relation must be bijective. |