Git Product home page Git Product logo

java-to-rust's Introduction

Java 2 Rust

Maintenance Eclipse Java

Author: Cesar Augusto Guzman Alvarez @cguz

Co-Author: Jonas Cir @JonasCir

Description

This is a command line tool based on the version web-application. Thus, all the credits for the original author of the web-application.

The application is a small help when trying to port Java-Code to Rust.

The author is a beginner in rust, so the generated code will sometimes be kind of "unrusty".

How to build it.

Run mvn package and find your java2rust.jar in the project's target folder.

How to use it.

$ java -jar java2rust.jar -d [path_file.java | path_directory]

The converted files will be saved in the folder: "output"

Implemented funcionality

  • might be of use:

    • conversion of declarations Java: "Type name = init" to "let name: Type = init"
    • conversion of arrays type[] to vectors
    • snake-case for camelcase-identifiers starting with lower case
    • mapping of primitive types
    • &self as first parameter in non static methods
    • new type becomes type::new
    • class becomes struct with its instance-variables
    • class-methods can be found in extra block impl for { }
    • decide about usage of mut
    • conversion of integer-constants to float-constants where necessary
    • conversion of Exceptions into Results
    • static methods are called using ::
    • @Test is converted to #[test]
    • interfaces become traits
    • Java methods with declared throws return Result<_,Rc> used rust code can be found in directory rust.
  • experimental

    • conversion of throw to break loop with label
    • mvn-assembly-plugin
    • convert camel-cased file names to snake-cased names
  • very experimental certainly wrongly done:

    • super-classes become instance-variables
  • what does not change

    • javadoc-comments

java-to-rust's People

Contributors

cguz avatar aschoerk avatar jonascir avatar gzsombor 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.