Expand description
Fundamental data types and type constructors, like Single, Pair, Many.
§Module :: fundamental_data_type
A collection of derive macros designed to enhance STD.
§To add to your project
cargo add fundamental_data_type§Try out from the repository
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/fundamental_data_type_trivial
cargo runModules§
- dependency
- Dependencies.
- exposed
- Exposed namespace of the module.
- orphan
- Orphan namespace of the module.
- prelude
- Prelude to use essentials:
use my_module::prelude::*. - protected
- Protected namespace of the module.
- wtools
- Types, which are extension of std.
Macros§
- from
- Variadic constructor.
Enums§
- Parse
Error - The
ParseErrorenum is a collection of all the possible reasons an enum can fail to parse from a string.
Traits§
- Add
- The addition operator
+. - AddAssign
- The addition assignment operator
+=. - AsStatic
Ref Deprecated - A cheap reference-to-reference conversion. Used to convert a value to a
reference value with
'staticlifetime within generic code. - Div
- The division operator
/. - DivAssign
- The division assignment operator
/=. - Enum
Count - A trait for capturing the number of variants in Enum. This trait can be autoderived by
strum_macros. - Enum
Message - Associates additional pieces of information with an Enum. This can be
autoimplemented by deriving
EnumMessageand annotating your variants with#[strum(message="...")]. - Enum
Property EnumPropertyis a trait that makes it possible to store additional information with enum variants. This trait is designed to be used with the macro of the same name in thestrum_macroscrate. Currently, the only string literals are supported in attributes, the other methods will be implemented as additional attribute types become stabilized.- Error
Erroris a trait representing the basic expectations for error values, i.e., values of typeEinResult<T, E>.- From_0
- Constructor without arguments. Alias of Default.
- From_1
- Constructor with single argument.
- From_2
- Constructor with two arguments.
- From_3
- Constructor with three arguments.
- Index
- Used for indexing operations (
container[index]) in immutable contexts. - Index
Mut - Used for indexing operations (
container[index]) in mutable contexts. - Into1
- value-to-value conversion that consumes the input value. Change left and rught, but keep semantic of `From_1``.
- Into
Enum Iterator - This trait designates that an
Enumcan be iterated over. It can be auto generated usingstrum_macroson your behalf. - Into
Iterator - Conversion into an
Iterator. - Mul
- The multiplication operator
*. - MulAssign
- The multiplication assignment operator
*=. - Not
- The unary logical negation operator
!. - Sub
- The subtraction operator
-. - SubAssign
- The subtraction assignment operator
-=. - Sum
- Trait to represent types that can be created by summing up an iterator.
- TryInto
- An attempted conversion that consumes
self, which may or may not be expensive. - Variant
Iterator - Variant
Metadata - Variant
Names - A trait for retrieving the names of each variant in Enum. This trait can
be autoderived by
strum_macros.
Functions§
- _clone_
boxed - Clone boxed dyn.
Attribute Macros§
- clone_
dyn - Derive macro to generate former for a structure. Former is variation of Builder Pattern.
Derive Macros§
- Add
- What
#[derive(Add)]generates - AddAssign
- What
#[derive(AddAssign)]generates - AsMut
- Derive macro to implement AsMut when-ever it’s possible to do automatically.
- AsRef
- Derive macro to implement AsRef when-ever it’s possible to do automatically.
- AsRef
Str - Converts enum variants to
&'static str. - AsStatic
Str - Constructor
- What
#[derive(Constructor)]generates - Deref
- Derive macro to implement Deref when-ever it’s possible to do automatically.
- Deref
Mut - Derive macro to implement Deref when-ever it’s possible to do automatically.
- Display
- Div
- What
#[derive(Mul)]generates - DivAssign
- What
#[derive(MulAssign)]generates - Enum
Count - Add a constant
usizeequal to the number of variants. - Enum
Discriminants - Generate a new type with only the discriminant names.
- EnumIs
- Generated
is_*()methods for each variant. E.g.Color.is_red(). - Enum
Iter - Creates a new type that iterates of the variants of an enum.
- Enum
Message - Add a verbose message to an enum variant.
- Enum
Property - Add custom properties to enum variants.
- Enum
String - Converts strings to enum variants based on their name.
- Enum
TryAs - Generated
try_as_*()methods for all tuple-style variants. E.g.Message.try_as_write(). - Enum
Variant Names - Implements
Strum::VariantNameswhich adds an associated constantVARIANTSwhich is an array of discriminant names. - Error
- Using
#[derive(Error)] - From
- Provides an automatic
Fromimplementation for struct wrapping a single value. - From
Inner - Alias for derive
From. Provides an automaticFromimplementation for struct wrapping a single value. - From
Repr - Add a function to enum that allows accessing variants by its discriminant
- FromStr
- Index
- What
#[derive(Index)]generates - Index
Mut - What
#[derive(IndexMut)]generates - Inner
From - Derive macro to implement From converting outer type into inner when-ever it’s possible to do automatically.
- Into
Iterator - Using
#[derive(IntoIterator)] - Into
Static Str - Implements
From<MyEnum> for &'static stron an enum. - IsVariant
- What
#[derive(IsVariant)]generates - Mul
- What
#[derive(Mul)]generates - MulAssign
- What
#[derive(MulAssign)]generates - Not
- What
#[derive(Not)]generates - Sub
- What
#[derive(Add)]generates - SubAssign
- What
#[derive(AddAssign)]generates - Sum
- Using
#[derive(Sum)] - ToString
- implements
std::string::ToStringon an enum - TryInto
- What
#[derive(TryInto)]generates - Unwrap
- What
#[derive(Unwrap)]generates - Variadic
From - Derive macro to implement default constructors
From_0,From_1,From_2,From_3.