• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust macro for automatically generating default

Build Status Latest Version Rust Documentation

Rust SmartDefault

Custom derive for automatically implementing the Default trait with customized default values:

use smart_default::SmartDefault;

#[derive(SmartDefault)]
enum Foo {
    Bar,
    #[default]
    Baz {
        #[default = 12]
        a: i32,
        b: i32,
        #[default(Some(Default::default()))]
        c: Option<i32>,
        #[default(_code = "vec![1, 2, 3]")]
        d: Vec<u32>,
        #[default = "four"]
        e: String,
    },
    Qux(i32),
}

assert!(Foo::default() == Foo::Baz {
    a: 12,
    b: 0,
    c: Some(0),
    d: vec![1, 2, 3],
    e: "four".to_owned(),
});

Requires Rust 1.30+ (for non-string values in attributes)

More Repositories

1

rust-typed-builder

Compile-time type-checked builder derive
Rust
847
star
2

vim-vebugger

Yes, we do need another debugger plugin
Vim Script
425
star
3

vim-merginal

Fugitive extension to manage and merge Git branches
Vim Script
277
star
4

bevy-tnua

A floating character controller for Bevy
Rust
203
star
5

bevy-yoleck

Your Own Level Editor Creation Kit
Rust
172
star
6

vim-dutyl

Coordinate D tools to work together for you
Vim Script
79
star
7

vim-smile

The power of :smile available to everyone
Vim Script
30
star
8

bevy-egui-kbgp

Better keyboard and gamepad story for egui in Bevy
Rust
20
star
9

nvim-moonicipal

Task runner with focus on rapidly changing personal tasks
Lua
15
star
10

nu_plugin_skim

Rust
14
star
11

woab

Widgets on Actors Bridge - a GUI microframework for combining GTK with Actix
Rust
14
star
12

vim-yankitute

regex powered yank+substitute
Vim Script
13
star
13

vim-makecfg

Database of `makeprg` and `errorformat` settings
Vim Script
13
star
14

vim-casetrate

Modify the case of identifiers
Vim Script
11
star
15

vimConfig

My vim configurations
Lua
11
star
16

rust-powerset-enum

Rust
11
star
17

nvim-impairative

Lua
11
star
18

vim-omnipytent

The all powerful Pythonic task runner
Python
10
star
19

nvim-buffls

Add LSP functionality to specific Neovim buffers
Lua
9
star
20

bevy-yoetz

Rust
8
star
21

rust-inherent-pub

Rust
7
star
22

vim-erroneous

The right way to handle errors
Vim Script
7
star
23

nvim-channelot

Operate Neovim jobs from Lua coroutines
Lua
6
star
24

breeze.vim

Html navigation like vim-easymotion, tag matching, tag highlighting and DOM navigation
Python
6
star
25

nvim-days-without

Lua
6
star
26

nvim-blunder

Run commands in the builtin terminal and parse their output to the quickfix list
Lua
4
star
27

vim-integrake

Abuse Rake to do project chores around Vim
Ruby
3
star
28

vim-tabnine-completefunc

A TabNine completefunc for Vim
Vim Script
2
star
29

vim-terminalogy

Show and tell with a shell
Vim Script
2
star
30

sidekick-jam-entry-danger-doofus

Rust
1
star
31

kosem

Test wizard for semi-automatic testing
Rust
1
star
32

rust-poc-macro-emit-data

Rust
1
star
33

bevy-game-jam-1-entry

Rust
1
star