Create Rust Project

This commit is contained in:
GuilhermeWerner
2021-02-24 09:12:23 -03:00
parent b456f20a4f
commit 36df99c7e0
13 changed files with 230 additions and 0 deletions

2
.cargo/config.toml Normal file
View File

@ -0,0 +1,2 @@
[build]
target-dir = "Binaries"

26
Cargo.toml Normal file
View File

@ -0,0 +1,26 @@
[package]
name = "tribufu"
version = "0.0.1"
description = "TribuFu SDK"
repository = "https://github.com/TribuFu/SDK"
authors = ["TribuFu <contact@tribufu.com>"]
license = "Apache-2.0"
readme = "README.md"
edition = "2018"
publish = true
[lib]
name="TribuFu"
crate-type = ["staticlib", "cdylib", "rlib"]
path = "Source/TribuFu.rs"
[dependencies]
libc = "0.2.0"
tokio = { version = "1.2.0", features = ["full"] }
reqwest = { version = "0.11.1", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
[[example]]
name="Hello"
path = "Examples/Rust/Hello.rs"

10
Examples/Rust/Hello.rs Normal file
View File

@ -0,0 +1,10 @@
// Copyright (c) TribuFu. All Rights Reserved
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
fn main() {
println!("TribuFu SDK = {}", TribuFu::Hello());
}

35
Source/Account/Auth.rs Normal file
View File

@ -0,0 +1,35 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn Login(name: *const c_char, password: *const c_char) {}
pub fn Logout() {}
pub fn Refresh() {}
pub fn Register(name: *const c_char, email: *const c_char, password: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn Login(name: *const c_char, password: *const c_char) {
super::Login(name, password);
}
#[no_mangle]
pub extern "C" fn Logout() {
super::Logout();
}
#[no_mangle]
pub extern "C" fn Refresh() {
super::Refresh();
}
#[no_mangle]
pub extern "C" fn Register(name: *const c_char, email: *const c_char, password: *const c_char) {
super::Register(name, email, password);
}
}

21
Source/Account/Device.rs Normal file
View File

@ -0,0 +1,21 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetDevice(id: *const c_char) {}
pub fn GetUserDevices(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetDevice(id: *const c_char) {
super::GetDevice(id);
}
#[no_mangle]
pub extern "C" fn GetUserDevices(id: *const c_char) {
super::GetUserDevices(id);
}
}

21
Source/Account/Email.rs Normal file
View File

@ -0,0 +1,21 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetEmail(address: *const c_char) {}
pub fn GetUserEmails(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetEmail(address: *const c_char) {
super::GetEmail(address);
}
#[no_mangle]
pub extern "C" fn GetUserEmails(id: *const c_char) {
super::GetUserEmails(id);
}
}

21
Source/Account/Role.rs Normal file
View File

@ -0,0 +1,21 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetRole(id: *const c_char) {}
pub fn GetUserRoles(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetRole(id: *const c_char) {
super::GetRole(id);
}
#[no_mangle]
pub extern "C" fn GetUserRoles(id: *const c_char) {
super::GetUserRoles(id);
}
}

14
Source/Account/User.rs Normal file
View File

@ -0,0 +1,14 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetUser(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetUser(id: *const c_char) {
super::GetUser(id);
}
}

6
Source/Account/mod.rs Normal file
View File

@ -0,0 +1,6 @@
// Copyright (c) TribuFu. All Rights Reserved
pub mod Auth;
pub mod Device;
pub mod Role;
pub mod User;

28
Source/Friends/mod.rs Normal file
View File

@ -0,0 +1,28 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn AddFriend(id1: *const c_char, id2: *const c_char) {}
pub fn AcceptFriend(id1: *const c_char, id2: *const c_char) {}
pub fn GetFriends(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn AddFriend(id1: *const c_char, id2: *const c_char) {
super::AddFriend(id1, id2);
}
#[no_mangle]
pub extern "C" fn AcceptFriend(id1: *const c_char, id2: *const c_char) {
super::AcceptFriend(id1, id2);
}
#[no_mangle]
pub extern "C" fn GetFriends(id: *const c_char) {
super::GetFriends(id);
}
}

17
Source/Matchmaking/mod.rs Normal file
View File

@ -0,0 +1,17 @@
// Copyright (c) TribuFu. All Rights Reserved
pub fn InviteToTeam() {}
pub fn EnterTeam() {}
mod External {
#[no_mangle]
pub extern "C" fn InviteToTeam() {
super::InviteToTeam();
}
#[no_mangle]
pub extern "C" fn EnterTeam() {
super::EnterTeam();
}
}

14
Source/Messages/mod.rs Normal file
View File

@ -0,0 +1,14 @@
// Copyright (c) TribuFu. All Rights Reserved
use libc::c_char;
pub fn GetMessage(id: *const c_char) {}
mod External {
use libc::c_char;
#[no_mangle]
pub extern "C" fn GetMessage(id: *const c_char) {
super::GetMessage(id);
}
}

15
Source/TribuFu.rs Normal file
View File

@ -0,0 +1,15 @@
// Copyright (c) TribuFu. All Rights Reserved
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
pub mod Account;
pub mod Friends;
pub mod Matchmaking;
pub mod Messages;
#[no_mangle]
pub extern "C" fn Hello() -> i32 {
return 1;
}