#template #diamond-fire #system #generate #function #json #diamondfire

rustfire

A crate that allows you to use Rust to generate DiamondFire templates

3 unstable releases

0.2.0 Feb 26, 2023
0.1.1 Feb 26, 2023
0.1.0 Feb 26, 2023

#393 in Template engine

MIT license

21KB
447 lines

Rustfire

open issues rustfire version maintain status docs status chat

Note: This project is not ready for full usage. Please refrain from main usage until 1.0.0. This is because syntax is constantly changing and new systems are being added/removed.

RustFire is a project coded in Rust. It allows users to create DiamondFire templates through the use of the Rust programming language.

Installation

You can either type the following into your command prompt:

cargo add rustfire

or add the following to your cargo.toml:

[dependencies]
rustfire = "0.2.0"

Dependencies of this will be installed automatically.

After this, you will want to install Python 3 (if you don't have it already) and add the following to the root directory of your project. This file should be called send.py:

import socket
import sys
import json

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

try:
    # Connect to server and send data
    sock.connect(("localhost", 31372))
    sock.sendall(bytes(sys.argv[1],encoding="utf-8"))
finally:
    sock.close()

This code opens a socket on 31372 for RustFire to send templates through. This will later be implemented as base into RustFire.

Usage

Here is a basic program written in RustFire.

use rustfire::*;

// Code to be ran. This is usually split into multiple functions.
fn main() {
    build_set!("Player Join Event"); // Template name. System will soon be reworked.
    player_event!(join); // Player Join Event. 
    select!(all_players); // Select all players. By default, all codeblocks have the Selection target. This system will be reworked soon.
    player_action!(send_message "text::&a&lJOINED! &e%default &7has joined!"); // Send the player a message
    build!(); // Send code to Recode.
}

Check the examples directory for more examples.

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This project falls under the MIT license. Read it at LICENSE.txt

Documentation

coming soonTM

Dependencies

~0.8–1.1MB
~18K SLoC