Code Monkey home page Code Monkey logo

rust-struct-crusher-2404's Introduction

Rust Struct Crusher

It crushes struct definiton of the given rust file

Goal Examples

struct S;     // Input 1  - unit struct
struct S();   // Output 1 - crush it to empty-tuple struct

struct DropMe(&'static str); // Input 2  - nonempty-tuple struct
struct DropMe();            // Output 2 - empty-tuple struct

struct S { t: i32 }   // Input 3  - struct struct
struct S;             // Ouptut 3 - unit struct

If multiple struct definition exists in one file, crushes one-by-one, and save it as separate file.

// Input File "asdf.rs"
struct S;
struct DropMe(& 'static str);


// Output File 1 "asdf_1.rs"
struct S();
struct DropMe(& 'static str);


// Output File 2 "asdf_2.rs"
struct S;
struct DropMe();

How to use?

  • Use with cargo run
# Example
❯ cargo run -- --input-dir example_data --output-dir ./out

11it [00:00, 1954.17it/s]
Number of generated files: 8
Created output directory: ./out

Typename Crusher

try to crush type name!

Goal Examples

fn foo(a: t) {}      // Input with type

fn foo(a: ) {}       // Output 1 - Remove type
fn foo(a: i32) {}    // Output 2 - change to i32
fn foo(a: str) {}    // Output 3 - change to str
fn foo(a: Copy) {}   // Output 4 - chagne to Copy

rust-struct-crusher-2404's People

Contributors

cushionbadak avatar

Stargazers

flow avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.