Keine Beschreibung
- Rust 100%
| .cargo | ||
| core | ||
| wrappers | ||
| .editorconfig | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| clippy.toml | ||
| deny.toml | ||
| README.md | ||
| rustfmt.toml | ||
Common Macros
This is an library i made to make it easier to do stuff with unsynn
Core
This is an basic library it currently implements this:
- CompileError: An wrapper to emit an Compile Error
- flatten_tokenstream: Cleans up the tokenstream an simplifies the stream.
- Attribute & Metadata: Type Aliases to parse Attributes before an struct, function, ...
- Number: An Parser to parse Binary, Octal, Decimal and Hexadecimal Numbers
- an way to decode and encode such numbers without prefix is planned
Wrappers
This is an Crate based on the core Crate. Its purpose is for Enums that wrap different types that can only be contained in an enum, but share an common methods of usage. The Macro currently can handle only lifetime generics at the moment. in the end it is planned to be used like this:
wrap_enum!{
pub enum Example<'a> {
VariantA(ForeignType<'a, u8>),
VariantB(ForeignType<'a, u16>),
VariantC(ForeignType<'a, u32>),
VariantD(ForeignType<'a, u64>),
}
pub fn operation(&self, value) -> TypeB<'a> {
value.operation()
}
pub fn operation2(&self, value, added_argument: bool) -> TypeB<'a> {
value.operation2(added_argument)
}
}
In this example the output would result in something like this(Default trait implementations like From excluded):
pub enum Example<'a> {
VariantA(ForeignType<'a, u8>),
VariantB(ForeignType<'a, u16>),
VariantC(ForeignType<'a, u32>),
VariantD(ForeignType<'a, u64>),
}
impl<'a> Example<'a> {
pub fn operation(&self) -> TypeB<'a> {
match self {
Self::VariantA(value)=>value.operation(),
Self::VariantB(value)=>value.operation(),
Self::VariantC(value)=>value.operation(),
Self::VariantD(value)=>value.operation(),
}
}
pub fn operation2(&self, added_argument: bool) -> TypeB<'a> {
match self {
Self::VariantA(value)=>value.operation2(added_argument),
Self::VariantB(value)=>value.operation2(added_argument),
Self::VariantC(value)=>value.operation2(added_argument),
Self::VariantD(value)=>value.operation2(added_argument),
}
}
}