mirror of
https://github.com/tribufu/sdk-rust
synced 2026-02-04 17:33:07 +00:00
Compare commits
3 Commits
native
...
openapi-ge
| Author | SHA1 | Date | |
|---|---|---|---|
| 431db65471 | |||
| 7cbe6e451d | |||
| 0b32ab460c |
@@ -1,14 +0,0 @@
|
|||||||
[build]
|
|
||||||
rustflags = ["--cfg", "uuid_unstable"]
|
|
||||||
|
|
||||||
[profile.dev]
|
|
||||||
lto = "off"
|
|
||||||
|
|
||||||
[profile.release]
|
|
||||||
lto = "thin"
|
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")']
|
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
|
||||||
|
|
||||||
[target.'cfg(target_family = "wasm")']
|
|
||||||
rustflags = ["--cfg", "web_sys_unstable_apis"]
|
|
||||||
221
.clang-format
221
.clang-format
@@ -1,221 +0,0 @@
|
|||||||
---
|
|
||||||
Language: Cpp
|
|
||||||
AccessModifierOffset: -4
|
|
||||||
AlignAfterOpenBracket: Align
|
|
||||||
AlignArrayOfStructures: None
|
|
||||||
AlignConsecutiveAssignments:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
PadOperators: true
|
|
||||||
AlignConsecutiveBitFields:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
PadOperators: false
|
|
||||||
AlignConsecutiveDeclarations:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
PadOperators: false
|
|
||||||
AlignConsecutiveMacros:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
PadOperators: false
|
|
||||||
AlignEscapedNewlines: Right
|
|
||||||
AlignOperands: Align
|
|
||||||
AlignTrailingComments:
|
|
||||||
Kind: Always
|
|
||||||
OverEmptyLines: 0
|
|
||||||
AllowAllArgumentsOnNextLine: true
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: true
|
|
||||||
AllowShortBlocksOnASingleLine: Never
|
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
AllowShortEnumsOnASingleLine: false
|
|
||||||
AllowShortFunctionsOnASingleLine: None
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
|
||||||
AllowShortLambdasOnASingleLine: All
|
|
||||||
AllowShortLoopsOnASingleLine: false
|
|
||||||
AlwaysBreakAfterDefinitionReturnType: None
|
|
||||||
AlwaysBreakAfterReturnType: None
|
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
|
||||||
AlwaysBreakTemplateDeclarations: MultiLine
|
|
||||||
AttributeMacros:
|
|
||||||
- __capability
|
|
||||||
BinPackArguments: true
|
|
||||||
BinPackParameters: true
|
|
||||||
BitFieldColonSpacing: Both
|
|
||||||
BraceWrapping:
|
|
||||||
AfterCaseLabel: false
|
|
||||||
AfterClass: true
|
|
||||||
AfterControlStatement: Always
|
|
||||||
AfterEnum: true
|
|
||||||
AfterExternBlock: true
|
|
||||||
AfterFunction: true
|
|
||||||
AfterNamespace: true
|
|
||||||
AfterObjCDeclaration: true
|
|
||||||
AfterStruct: true
|
|
||||||
AfterUnion: false
|
|
||||||
BeforeCatch: true
|
|
||||||
BeforeElse: true
|
|
||||||
BeforeLambdaBody: false
|
|
||||||
BeforeWhile: false
|
|
||||||
IndentBraces: false
|
|
||||||
SplitEmptyFunction: true
|
|
||||||
SplitEmptyRecord: true
|
|
||||||
SplitEmptyNamespace: true
|
|
||||||
BreakAfterAttributes: Never
|
|
||||||
BreakAfterJavaFieldAnnotations: false
|
|
||||||
BreakArrays: true
|
|
||||||
BreakBeforeBinaryOperators: None
|
|
||||||
BreakBeforeConceptDeclarations: Always
|
|
||||||
BreakBeforeBraces: Custom
|
|
||||||
BreakBeforeInlineASMColon: OnlyMultiline
|
|
||||||
BreakBeforeTernaryOperators: true
|
|
||||||
BreakConstructorInitializers: BeforeColon
|
|
||||||
BreakInheritanceList: BeforeColon
|
|
||||||
BreakStringLiterals: true
|
|
||||||
ColumnLimit: 120
|
|
||||||
CommentPragmas: "^ IWYU pragma:"
|
|
||||||
CompactNamespaces: false
|
|
||||||
ConstructorInitializerIndentWidth: 4
|
|
||||||
ContinuationIndentWidth: 4
|
|
||||||
Cpp11BracedListStyle: true
|
|
||||||
DerivePointerAlignment: false
|
|
||||||
DisableFormat: false
|
|
||||||
EmptyLineAfterAccessModifier: Never
|
|
||||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
|
||||||
ExperimentalAutoDetectBinPacking: false
|
|
||||||
FixNamespaceComments: false
|
|
||||||
ForEachMacros:
|
|
||||||
- foreach
|
|
||||||
- Q_FOREACH
|
|
||||||
- BOOST_FOREACH
|
|
||||||
IfMacros:
|
|
||||||
- KJ_IF_MAYBE
|
|
||||||
IncludeBlocks: Preserve
|
|
||||||
IncludeCategories:
|
|
||||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
|
||||||
Priority: 2
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
|
||||||
Priority: 3
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: ".*"
|
|
||||||
Priority: 1
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
IncludeIsMainRegex: "(Test)?$"
|
|
||||||
IncludeIsMainSourceRegex: ""
|
|
||||||
IndentAccessModifiers: false
|
|
||||||
IndentCaseBlocks: false
|
|
||||||
IndentCaseLabels: false
|
|
||||||
IndentExternBlock: AfterExternBlock
|
|
||||||
IndentGotoLabels: true
|
|
||||||
IndentPPDirectives: None
|
|
||||||
IndentRequiresClause: true
|
|
||||||
IndentWidth: 4
|
|
||||||
IndentWrappedFunctionNames: false
|
|
||||||
InsertBraces: false
|
|
||||||
InsertNewlineAtEOF: false
|
|
||||||
InsertTrailingCommas: None
|
|
||||||
IntegerLiteralSeparator:
|
|
||||||
Binary: 0
|
|
||||||
Decimal: 0
|
|
||||||
Hex: 0
|
|
||||||
JavaScriptQuotes: Leave
|
|
||||||
JavaScriptWrapImports: true
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
||||||
LambdaBodyIndentation: Signature
|
|
||||||
LineEnding: DeriveLF
|
|
||||||
MacroBlockBegin: ""
|
|
||||||
MacroBlockEnd: ""
|
|
||||||
MaxEmptyLinesToKeep: 1
|
|
||||||
NamespaceIndentation: All
|
|
||||||
ObjCBinPackProtocolList: Auto
|
|
||||||
ObjCBlockIndentWidth: 2
|
|
||||||
ObjCBreakBeforeNestedBlockParam: true
|
|
||||||
ObjCSpaceAfterProperty: false
|
|
||||||
ObjCSpaceBeforeProtocolList: true
|
|
||||||
PackConstructorInitializers: BinPack
|
|
||||||
PenaltyBreakAssignment: 2
|
|
||||||
PenaltyBreakBeforeFirstCallParameter: 19
|
|
||||||
PenaltyBreakComment: 300
|
|
||||||
PenaltyBreakFirstLessLess: 120
|
|
||||||
PenaltyBreakOpenParenthesis: 0
|
|
||||||
PenaltyBreakString: 1000
|
|
||||||
PenaltyBreakTemplateDeclaration: 10
|
|
||||||
PenaltyExcessCharacter: 1000000
|
|
||||||
PenaltyIndentedWhitespace: 0
|
|
||||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
|
||||||
PointerAlignment: Right
|
|
||||||
PPIndentWidth: -1
|
|
||||||
QualifierAlignment: Leave
|
|
||||||
ReferenceAlignment: Pointer
|
|
||||||
ReflowComments: true
|
|
||||||
RemoveBracesLLVM: false
|
|
||||||
RemoveSemicolon: false
|
|
||||||
RequiresClausePosition: OwnLine
|
|
||||||
RequiresExpressionIndentation: OuterScope
|
|
||||||
SeparateDefinitionBlocks: Leave
|
|
||||||
ShortNamespaceLines: 1
|
|
||||||
SortIncludes: CaseSensitive
|
|
||||||
SortJavaStaticImport: Before
|
|
||||||
SortUsingDeclarations: LexicographicNumeric
|
|
||||||
SpaceAfterCStyleCast: false
|
|
||||||
SpaceAfterLogicalNot: false
|
|
||||||
SpaceAfterTemplateKeyword: true
|
|
||||||
SpaceAroundPointerQualifiers: Default
|
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
SpaceBeforeCaseColon: false
|
|
||||||
SpaceBeforeCpp11BracedList: false
|
|
||||||
SpaceBeforeCtorInitializerColon: true
|
|
||||||
SpaceBeforeInheritanceColon: true
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
SpaceBeforeParensOptions:
|
|
||||||
AfterControlStatements: true
|
|
||||||
AfterForeachMacros: true
|
|
||||||
AfterFunctionDefinitionName: false
|
|
||||||
AfterFunctionDeclarationName: false
|
|
||||||
AfterIfMacros: true
|
|
||||||
AfterOverloadedOperator: false
|
|
||||||
AfterRequiresInClause: false
|
|
||||||
AfterRequiresInExpression: false
|
|
||||||
BeforeNonEmptyParentheses: false
|
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
|
||||||
SpaceBeforeSquareBrackets: false
|
|
||||||
SpaceInEmptyBlock: false
|
|
||||||
SpaceInEmptyParentheses: false
|
|
||||||
SpacesBeforeTrailingComments: 1
|
|
||||||
SpacesInAngles: Never
|
|
||||||
SpacesInConditionalStatement: false
|
|
||||||
SpacesInContainerLiterals: true
|
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInLineCommentPrefix:
|
|
||||||
Minimum: 1
|
|
||||||
Maximum: -1
|
|
||||||
SpacesInParentheses: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
Standard: Latest
|
|
||||||
StatementAttributeLikeMacros:
|
|
||||||
- Q_EMIT
|
|
||||||
StatementMacros:
|
|
||||||
- Q_UNUSED
|
|
||||||
- QT_REQUIRE_VERSION
|
|
||||||
TabWidth: 4
|
|
||||||
UseTab: Never
|
|
||||||
WhitespaceSensitiveMacros:
|
|
||||||
- BOOST_PP_STRINGIZE
|
|
||||||
- CF_SWIFT_NAME
|
|
||||||
- NS_SWIFT_NAME
|
|
||||||
- PP_STRINGIZE
|
|
||||||
- STRINGIZE
|
|
||||||
---
|
|
||||||
|
|
||||||
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,17 +1,40 @@
|
|||||||
|
__pycache__/
|
||||||
|
.gradle/
|
||||||
|
.idea/
|
||||||
|
.metals/
|
||||||
|
.next/
|
||||||
|
.parcel-cache/
|
||||||
.vs/
|
.vs/
|
||||||
.vscode/
|
.vscode/
|
||||||
bin/
|
bin/
|
||||||
|
binaries/
|
||||||
|
build/
|
||||||
|
node_modules/
|
||||||
|
obj/
|
||||||
|
saved/
|
||||||
target/
|
target/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env
|
.env
|
||||||
|
*.crt
|
||||||
|
*.csproj
|
||||||
*.filters
|
*.filters
|
||||||
|
*.fsproj
|
||||||
|
*.key
|
||||||
|
*.log
|
||||||
*.make
|
*.make
|
||||||
|
*.mwb.bak
|
||||||
|
*.pem
|
||||||
*.sln
|
*.sln
|
||||||
*.user
|
*.user
|
||||||
*.vcxproj
|
*.vcxproj
|
||||||
|
*.vpp.*
|
||||||
|
*.wasm
|
||||||
*.xcodeproj
|
*.xcodeproj
|
||||||
*.xcworkspace
|
*.xcworkspace
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
desktop.ini
|
desktop.ini
|
||||||
|
keystore.jks
|
||||||
|
local.properties
|
||||||
Makefile
|
Makefile
|
||||||
|
next-env.d.ts
|
||||||
|
|||||||
@@ -22,18 +22,12 @@ exclude = [
|
|||||||
"scripts/",
|
"scripts/",
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace]
|
|
||||||
resolver = "2"
|
|
||||||
members = ["src/*"]
|
|
||||||
exclude = ["src/apis", "src/models"]
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "tribufu"
|
name = "tribufu"
|
||||||
crate-type = ["rlib"]
|
crate-type = ["rlib"]
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tribufu-constants = { version = "0.0.5", path = "./src/constants" }
|
|
||||||
async-trait = "^0.1"
|
async-trait = "^0.1"
|
||||||
reqwest = { version = "^0.12", features = ["json", "multipart"] }
|
reqwest = { version = "^0.12", features = ["json", "multipart"] }
|
||||||
serde = { version = "^1.0", features = ["derive"] }
|
serde = { version = "^1.0", features = ["derive"] }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Tribufu Rust
|
# Tribufu Rust
|
||||||
|
|
||||||
Native SDK to access Tribufu APIs and services.
|
Rust SDK to access Tribufu APIs and services.
|
||||||
|
|
||||||
[![Crates.io][crates-badge]][crates-url]
|
[![Crates.io][crates-badge]][crates-url]
|
||||||
[![MIT License][mit-badge]][mit-url]
|
[![MIT License][mit-badge]][mit-url]
|
||||||
@@ -9,7 +9,7 @@ Native SDK to access Tribufu APIs and services.
|
|||||||
[crates-badge]: https://img.shields.io/crates/v/tribufu.svg
|
[crates-badge]: https://img.shields.io/crates/v/tribufu.svg
|
||||||
[crates-url]: https://crates.io/crates/tribufu
|
[crates-url]: https://crates.io/crates/tribufu
|
||||||
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||||
[mit-url]: https://github.com/tribufu/tribufu-rust/blob/main/LICENSE.txt
|
[mit-url]: https://github.com/Tribufu/TribufuRust/blob/main/LICENSE.txt
|
||||||
[discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square
|
[discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square
|
||||||
[discord-url]: https://www.tribufu.com/discord
|
[discord-url]: https://www.tribufu.com/discord
|
||||||
|
|
||||||
@@ -20,4 +20,4 @@ Native SDK to access Tribufu APIs and services.
|
|||||||
|
|
||||||
This project is licensed under the [MIT License].
|
This project is licensed under the [MIT License].
|
||||||
|
|
||||||
[MIT License]: https://github.com/tribufu/tribufu-rust/blob/main/LICENSE.txt
|
[MIT License]: https://github.com/Tribufu/TribufuRust/blob/main/LICENSE.txt
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
language = "C"
|
|
||||||
header = "// Copyright (c) Tribufu. All Rights Reserved.\n// SPDX-License-Identifier: MIT"
|
|
||||||
pragma_once = true
|
|
||||||
include_version = false
|
|
||||||
namespaces = []
|
|
||||||
using_namespaces = []
|
|
||||||
sys_includes = ["tribufu/prelude.h"]
|
|
||||||
includes = []
|
|
||||||
no_includes = true
|
|
||||||
cpp_compat = false
|
|
||||||
braces = "NextLine"
|
|
||||||
line_length = 100
|
|
||||||
tab_width = 4
|
|
||||||
documentation = true
|
|
||||||
documentation_style = "doxy"
|
|
||||||
style = "tag"
|
|
||||||
|
|
||||||
[defines]
|
|
||||||
"debug_assertions" = "TRIBUFU_DEBUG"
|
|
||||||
"not(debug_assertions)" = "TRIBUFU_RELEASE"
|
|
||||||
"panic = abort" = "TRIBUFU_PANIC_ABORT"
|
|
||||||
"panic = unwind" = "TRIBUFU_PANIC_UNWIND"
|
|
||||||
"proc_macro" = "TRIBUFU_PROC_MACRO"
|
|
||||||
"target_arch = aarch64" = "TRIBUFU_AARCH64"
|
|
||||||
"target_arch = arm" = "TRIBUFU_ARM"
|
|
||||||
"target_arch = armV7" = "TRIBUFU_ARMV7"
|
|
||||||
"target_arch = armv4t" = "TRIBUFU_ARMV4T"
|
|
||||||
"target_arch = armv6" = "TRIBUFU_ARMV6"
|
|
||||||
"target_arch = armv7a" = "TRIBUFU_ARMV7A"
|
|
||||||
"target_arch = armv7s" = "TRIBUFU_ARMV7S"
|
|
||||||
"target_arch = avr" = "TRIBUFU_AVR"
|
|
||||||
"target_arch = bpfeb" = "TRIBUFU_BPFEB"
|
|
||||||
"target_arch = bpfel" = "TRIBUFU_BPFEL"
|
|
||||||
"target_arch = hexagon" = "TRIBUFU_HEXAGON"
|
|
||||||
"target_arch = i386" = "TRIBUFU_I386"
|
|
||||||
"target_arch = i586" = "TRIBUFU_I586"
|
|
||||||
"target_arch = i686" = "TRIBUFU_I686"
|
|
||||||
"target_arch = m68k" = "TRIBUFU_M68K"
|
|
||||||
"target_arch = mips" = "TRIBUFU_MIPS"
|
|
||||||
"target_arch = mipsel" = "TRIBUFU_MIPSEL"
|
|
||||||
"target_arch = msp430" = "TRIBUFU_MSP430"
|
|
||||||
"target_arch = powerpc" = "TRIBUFU_POWERPC"
|
|
||||||
"target_arch = powerpc64" = "TRIBUFU_POWERPC64"
|
|
||||||
"target_arch = powerpc64l" = "TRIBUFU_POWERPC64L"
|
|
||||||
"target_arch = riscv32gc" = "TRIBUFU_RISCV32GC"
|
|
||||||
"target_arch = s390x" = "TRIBUFU_S390X"
|
|
||||||
"target_arch = sparc" = "TRIBUFU_SPARC"
|
|
||||||
"target_arch = sparc64" = "TRIBUFU_SPARC64"
|
|
||||||
"target_arch = thumbv4t" = "TRIBUFU_THUMBV4T"
|
|
||||||
"target_arch = thumbv7a" = "TRIBUFU_THUMBV7A"
|
|
||||||
"target_arch = thumbv7neon" = "TRIBUFU_THUMBV7NEON"
|
|
||||||
"target_arch = wasm32" = "TRIBUFU_WASM32"
|
|
||||||
"target_arch = wasm64" = "TRIBUFU_WASM64"
|
|
||||||
"target_arch = x86" = "TRIBUFU_X86"
|
|
||||||
"target_arch = x86_64" = "TRIBUFU_X86_64"
|
|
||||||
"target_endian = big" = "TRIBUFU_BIG_ENDIAN"
|
|
||||||
"target_endian = little" = "TRIBUFU_LITTLE_ENDIAN"
|
|
||||||
"target_env = gnu" = "TRIBUFU_GNU"
|
|
||||||
"target_env = msvc" = "TRIBUFU_MSVC"
|
|
||||||
"target_env = musl" = "TRIBUFU_MUSL"
|
|
||||||
"target_env = sgx" = "TRIBUFU_SGX"
|
|
||||||
"target_family = unix" = "TRIBUFU_UNIX"
|
|
||||||
"target_family = wasm" = "TRIBUFU_WASM"
|
|
||||||
"target_family = windows" = "TRIBUFU_MICROSOFT"
|
|
||||||
"target_feature = avx" = "TRIBUFU_AVX"
|
|
||||||
"target_feature = avx2" = "TRIBUFU_AVX2"
|
|
||||||
"target_feature = crt-static" = "TRIBUFU_CRTSTATIC"
|
|
||||||
"target_feature = rdrand" = "TRIBUFU_RDRAND"
|
|
||||||
"target_feature = sse" = "TRIBUFU_SSE"
|
|
||||||
"target_feature = sse2" = "TRIBUFU_SSE2"
|
|
||||||
"target_feature = sse4.1" = "TRIBUFU_SSE41"
|
|
||||||
"target_has_atomic = 128" = "TRIBUFU_ATOMIC_128"
|
|
||||||
"target_has_atomic = 16" = "TRIBUFU_ATOMIC_16"
|
|
||||||
"target_has_atomic = 32" = "TRIBUFU_ATOMIC_32"
|
|
||||||
"target_has_atomic = 64" = "TRIBUFU_ATOMIC_64"
|
|
||||||
"target_has_atomic = 8" = "TRIBUFU_ATOMIC_8"
|
|
||||||
"target_has_atomic = ptr" = "TRIBUFU_ATOMIC_PTR"
|
|
||||||
"target_os = android" = "TRIBUFU_ANDROID"
|
|
||||||
"target_os = dragonfly" = "TRIBUFU_DRAGONFLY"
|
|
||||||
"target_os = freebsd" = "TRIBUFU_FREEBSD"
|
|
||||||
"target_os = ios" = "TRIBUFU_IOS"
|
|
||||||
"target_os = linux" = "TRIBUFU_LINUX"
|
|
||||||
"target_os = macos" = "TRIBUFU_MACOS"
|
|
||||||
"target_os = netbsd" = "TRIBUFU_NETBSD"
|
|
||||||
"target_os = openbsd" = "TRIBUFU_OPENBSD"
|
|
||||||
"target_os = windows" = "TRIBUFU_WINDOWS"
|
|
||||||
"target_pointer_width = 16" = "TRIBUFU_POINTER_16"
|
|
||||||
"target_pointer_width = 32" = "TRIBUFU_POINTER_32"
|
|
||||||
"target_pointer_width = 64" = "TRIBUFU_POINTER_64"
|
|
||||||
"target_vendor = apple" = "TRIBUFU_APPLE"
|
|
||||||
"target_vendor = fortanix" = "TRIBUFU_FORTANIX"
|
|
||||||
"target_vendor = pc" = "TRIBUFU_MICROSOFT"
|
|
||||||
"target_vendor = unknown" = "TRIBUFU_UNKNOWN"
|
|
||||||
|
|
||||||
[export]
|
|
||||||
include = []
|
|
||||||
exclude = []
|
|
||||||
item_types = ["enums", "structs", "typedefs", "functions"]
|
|
||||||
renaming_overrides_prefixing = false
|
|
||||||
|
|
||||||
[layout]
|
|
||||||
packed = "PACKED"
|
|
||||||
aligned_n = "ALIGNED"
|
|
||||||
|
|
||||||
[fn]
|
|
||||||
prefix = "TRIBUFU_API"
|
|
||||||
args = "horizontal"
|
|
||||||
must_use = "MUST_USE_FUNC"
|
|
||||||
no_return = "NO_RETURN"
|
|
||||||
rename_args = "None"
|
|
||||||
sort_by = "Name"
|
|
||||||
|
|
||||||
[struct]
|
|
||||||
rename_fields = "None"
|
|
||||||
must_use = "MUST_USE_STRUCT"
|
|
||||||
derive_constructor = true
|
|
||||||
derive_eq = false
|
|
||||||
derive_neq = false
|
|
||||||
derive_lt = false
|
|
||||||
derive_lte = false
|
|
||||||
derive_gt = false
|
|
||||||
derive_gte = false
|
|
||||||
|
|
||||||
[enum]
|
|
||||||
rename_variants = "None"
|
|
||||||
add_sentinel = false
|
|
||||||
prefix_with_name = false
|
|
||||||
enum_class = false
|
|
||||||
derive_helper_methods = false
|
|
||||||
derive_const_casts = false
|
|
||||||
derive_mut_casts = false
|
|
||||||
must_use = "MUST_USE_ENUM"
|
|
||||||
derive_tagged_enum_destructor = false
|
|
||||||
derive_tagged_enum_copy_constructor = false
|
|
||||||
derive_tagged_enum_copy_assignment = false
|
|
||||||
private_default_tagged_enum_constructor = false
|
|
||||||
|
|
||||||
[const]
|
|
||||||
allow_static_const = true
|
|
||||||
allow_constexpr = false
|
|
||||||
sort_by = "Name"
|
|
||||||
|
|
||||||
[macro_expansion]
|
|
||||||
bitflags = true
|
|
||||||
|
|
||||||
[parse]
|
|
||||||
parse_deps = true
|
|
||||||
include = []
|
|
||||||
exclude = []
|
|
||||||
clean = false
|
|
||||||
extra_bindings = []
|
|
||||||
|
|
||||||
[parse.expand]
|
|
||||||
crates = []
|
|
||||||
all_features = true
|
|
||||||
default_features = true
|
|
||||||
features = []
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use tribufu::TribufuApi;
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() {
|
|
||||||
let user_agent = TribufuApi::get_user_agent();
|
|
||||||
println!("{}", user_agent);
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <tribufu/api.h>
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
tribufu_api_initialize();
|
|
||||||
char *version = tribufu_api_get_user_agent();
|
|
||||||
printf("%s\n", version);
|
|
||||||
tribufu_free_string(version);
|
|
||||||
tribufu_api_shutdown();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
--- @diagnostic disable: undefined-global
|
|
||||||
|
|
||||||
project "example_c"
|
|
||||||
location "."
|
|
||||||
kind "ConsoleApp"
|
|
||||||
language "C"
|
|
||||||
|
|
||||||
targetdir("../../bin/%{cfg.platform}")
|
|
||||||
objdir("../../target/%{cfg.buildcfg}/obj/%{prj.name}/%{cfg.platform}")
|
|
||||||
|
|
||||||
files
|
|
||||||
{
|
|
||||||
"./**.c",
|
|
||||||
"./**.h",
|
|
||||||
"../../include/**.h",
|
|
||||||
}
|
|
||||||
|
|
||||||
vpaths
|
|
||||||
{
|
|
||||||
["Sources"] = { "./**.c" },
|
|
||||||
["Headers"] = { "./**.h", "../../include/**.h" },
|
|
||||||
}
|
|
||||||
|
|
||||||
includedirs
|
|
||||||
{
|
|
||||||
"../../include",
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs
|
|
||||||
{
|
|
||||||
"../../bin/%{cfg.platform}",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Profile
|
|
||||||
|
|
||||||
filter { "configurations:debug" }
|
|
||||||
runtime "Debug"
|
|
||||||
symbols "On"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"DEBUG",
|
|
||||||
"TRACE",
|
|
||||||
"TRIBUFU_DEBUG",
|
|
||||||
"TRIBUFU_TRACE",
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "configurations:release" }
|
|
||||||
runtime "Release"
|
|
||||||
optimize "On"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"RELEASE",
|
|
||||||
"TRIBUFU_RELEASE",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Platform
|
|
||||||
|
|
||||||
filter { "platforms:win-*" }
|
|
||||||
system "windows"
|
|
||||||
systemversion "latest"
|
|
||||||
staticruntime "On"
|
|
||||||
toolset "msc"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_DESKTOP",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_WINDOWS",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk.lib",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:osx-*" }
|
|
||||||
system "macosx"
|
|
||||||
systemversion "10.15"
|
|
||||||
toolset "clang"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_APPLE",
|
|
||||||
"TRIBUFU_DESKTOP",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_MAC",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:linux-*" }
|
|
||||||
system "linux"
|
|
||||||
toolset "gcc"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_DESKTOP",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_LINUX",
|
|
||||||
"TRIBUFU_UNIX",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:android-*" }
|
|
||||||
system "android"
|
|
||||||
toolset "clang"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_ANDROID",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_MOBILE",
|
|
||||||
"TRIBUFU_UNIX",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:ios-*" }
|
|
||||||
system "ios"
|
|
||||||
systemversion "13.0"
|
|
||||||
toolset "clang"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_APPLE",
|
|
||||||
"TRIBUFU_IOS",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_MOBILE",
|
|
||||||
"TRIBUFU_MONOLITHIC",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Architecture
|
|
||||||
|
|
||||||
filter { "platforms:*-x86" }
|
|
||||||
architecture "x86"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_32BITS",
|
|
||||||
"TRIBUFU_X86",
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:*-x64" }
|
|
||||||
architecture "x64"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_64BITS",
|
|
||||||
"TRIBUFU_X64",
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:*-arm64" }
|
|
||||||
architecture "ARM64"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_64BITS",
|
|
||||||
"TRIBUFU_ARM64",
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <tribufu/api.h>
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
tribufu_api_initialize();
|
|
||||||
const char *version = tribufu_api_get_user_agent();
|
|
||||||
std::cout << version << std::endl;
|
|
||||||
tribufu_free_string((char *)version);
|
|
||||||
tribufu_api_shutdown();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
--- @diagnostic disable: undefined-global
|
|
||||||
|
|
||||||
project "example_cpp"
|
|
||||||
location "."
|
|
||||||
kind "ConsoleApp"
|
|
||||||
language "C++"
|
|
||||||
cppdialect "C++20"
|
|
||||||
|
|
||||||
targetdir("../../bin/%{cfg.platform}")
|
|
||||||
objdir("../../target/%{cfg.buildcfg}/obj/%{prj.name}/%{cfg.platform}")
|
|
||||||
|
|
||||||
files
|
|
||||||
{
|
|
||||||
"./**.cpp",
|
|
||||||
"./**.h",
|
|
||||||
"../../include/**.h",
|
|
||||||
}
|
|
||||||
|
|
||||||
vpaths
|
|
||||||
{
|
|
||||||
["Sources"] = { "./**.cpp" },
|
|
||||||
["Headers"] = { "./**.h", "../../include/**.h" },
|
|
||||||
}
|
|
||||||
|
|
||||||
includedirs
|
|
||||||
{
|
|
||||||
"../../include",
|
|
||||||
}
|
|
||||||
|
|
||||||
libdirs
|
|
||||||
{
|
|
||||||
"../../bin/%{cfg.platform}",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Profile
|
|
||||||
|
|
||||||
filter { "configurations:debug" }
|
|
||||||
runtime "Debug"
|
|
||||||
symbols "On"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"DEBUG",
|
|
||||||
"TRACE",
|
|
||||||
"TRIBUFU_DEBUG",
|
|
||||||
"TRIBUFU_TRACE",
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "configurations:release" }
|
|
||||||
runtime "Release"
|
|
||||||
optimize "On"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"RELEASE",
|
|
||||||
"TRIBUFU_RELEASE",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Platform
|
|
||||||
|
|
||||||
filter { "platforms:win-*" }
|
|
||||||
system "windows"
|
|
||||||
systemversion "latest"
|
|
||||||
staticruntime "On"
|
|
||||||
toolset "msc"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_DESKTOP",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_WINDOWS",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk.lib",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:osx-*" }
|
|
||||||
system "macosx"
|
|
||||||
systemversion "10.15"
|
|
||||||
toolset "clang"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_APPLE",
|
|
||||||
"TRIBUFU_DESKTOP",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_MAC",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:linux-*" }
|
|
||||||
system "linux"
|
|
||||||
toolset "gcc"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_DESKTOP",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_LINUX",
|
|
||||||
"TRIBUFU_UNIX",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:android-*" }
|
|
||||||
system "android"
|
|
||||||
toolset "clang"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_ANDROID",
|
|
||||||
"TRIBUFU_DYNAMIC",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_MOBILE",
|
|
||||||
"TRIBUFU_UNIX",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
prelinkcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
postbuildcommands
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:ios-*" }
|
|
||||||
system "ios"
|
|
||||||
systemversion "13.0"
|
|
||||||
toolset "clang"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_APPLE",
|
|
||||||
"TRIBUFU_IOS",
|
|
||||||
"TRIBUFU_LIBRARY",
|
|
||||||
"TRIBUFU_MOBILE",
|
|
||||||
"TRIBUFU_MONOLITHIC",
|
|
||||||
}
|
|
||||||
|
|
||||||
links
|
|
||||||
{
|
|
||||||
"tribufu_sdk",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Architecture
|
|
||||||
|
|
||||||
filter { "platforms:*-x86" }
|
|
||||||
architecture "x86"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_32BITS",
|
|
||||||
"TRIBUFU_X86",
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:*-x64" }
|
|
||||||
architecture "x64"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_64BITS",
|
|
||||||
"TRIBUFU_X64",
|
|
||||||
}
|
|
||||||
|
|
||||||
filter { "platforms:*-arm64" }
|
|
||||||
architecture "ARM64"
|
|
||||||
|
|
||||||
defines
|
|
||||||
{
|
|
||||||
"TRIBUFU_64BITS",
|
|
||||||
"TRIBUFU_ARM64",
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/api.h>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/native.h>
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define TRIBUFU_CPP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EXTERN_C
|
|
||||||
#ifdef TRIBUFU_CPP
|
|
||||||
#define EXTERN_C extern "C"
|
|
||||||
#else
|
|
||||||
#define EXTERN_C
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRIBUFU_API EXTERN_C
|
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef TRIBUFU_LIBRARY
|
|
||||||
#define TRIBUFU_API DLLEXPORT
|
|
||||||
#else
|
|
||||||
#define TRIBUFU_API DLLIMPORT
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/prelude.h>
|
|
||||||
|
|
||||||
typedef void TribufuApiGetUserInfoCallbackData;
|
|
||||||
|
|
||||||
typedef void (*TribufuApiGetUserInfoCallback)(void*, const TribufuApiGetUserInfoCallbackData*);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the user agent string for the Tribufu API.
|
|
||||||
*/
|
|
||||||
TRIBUFU_API const char *tribufu_api_get_user_agent(void);
|
|
||||||
|
|
||||||
TRIBUFU_API void tribufu_api_get_user_info(void *context, TribufuApiGetUserInfoCallback callback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the version of the Tribufu API.
|
|
||||||
*/
|
|
||||||
TRIBUFU_API const char *tribufu_api_get_version(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the Tribufu API instance.
|
|
||||||
*
|
|
||||||
* This must be called before any other API functions.
|
|
||||||
*/
|
|
||||||
TRIBUFU_API bool tribufu_api_initialize(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shutdown the Tribufu API instance.
|
|
||||||
*
|
|
||||||
* This must be called when the API is no longer needed.
|
|
||||||
*/
|
|
||||||
TRIBUFU_API void tribufu_api_shutdown(void);
|
|
||||||
|
|
||||||
TRIBUFU_API void tribufu_free_string(char *ptr);
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef DLLEXPORT
|
|
||||||
#define DLLEXPORT __declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
#ifndef DLLIMPORT
|
|
||||||
#define DLLIMPORT __declspec(dllimport)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __MACH__ || __APPLE__ || __linux__ || __FreeBSD__ || __ANDROID__
|
|
||||||
#ifndef DLLEXPORT
|
|
||||||
#define DLLEXPORT __attribute__((visibility("default")))
|
|
||||||
#endif
|
|
||||||
#ifndef DLLIMPORT
|
|
||||||
#define DLLIMPORT __attribute__((visibility("default")))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/macros.h>
|
|
||||||
#include <tribufu/platform.h>
|
|
||||||
#include <tribufu/std.h>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#ifdef TRIBUFU_CPP
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <functional>
|
|
||||||
#include <future>
|
|
||||||
#include <iostream>
|
|
||||||
#include <memory>
|
|
||||||
#include <new>
|
|
||||||
#include <ostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <thread>
|
|
||||||
#include <utility>
|
|
||||||
#endif
|
|
||||||
31
premake5.lua
31
premake5.lua
@@ -1,31 +0,0 @@
|
|||||||
--- @diagnostic disable: undefined-global
|
|
||||||
|
|
||||||
workspace "tribufu"
|
|
||||||
location "."
|
|
||||||
configurations { "debug", "release" }
|
|
||||||
|
|
||||||
if _ACTION == "vs2022" then
|
|
||||||
platforms {
|
|
||||||
"win-arm64",
|
|
||||||
"win-x64",
|
|
||||||
"win-x86",
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
if _ACTION == "gmake2" then
|
|
||||||
platforms {
|
|
||||||
"linux-arm64",
|
|
||||||
"linux-x64",
|
|
||||||
"linux-x86",
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
if _ACTION == "xcode4" then
|
|
||||||
platforms {
|
|
||||||
"osx-arm64",
|
|
||||||
"osx-x64",
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
include "examples/c"
|
|
||||||
include "examples/cpp"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
cbindgen --config ./config/cbindgen.toml --crate tribufu-sdk --output ./include/tribufu/native.h
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]
|
|
||||||
then
|
|
||||||
./vendor/premake-core/linux/premake5 gmake2
|
|
||||||
|
|
||||||
elif [ "$(uname)" = "Darwin" ]
|
|
||||||
then
|
|
||||||
./vendor/premake-core/mac/premake5 xcode4
|
|
||||||
fi
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env pwsh
|
|
||||||
|
|
||||||
echo "Building for win-x64"
|
|
||||||
cargo build --workspace
|
|
||||||
|
|
||||||
New-Item "bin/win-x64" -ItemType Directory -Force
|
|
||||||
Remove-Item -Path "bin/win-x64/*" -Force -Recurse
|
|
||||||
|
|
||||||
Copy-Item -Path "target/debug/tribufu_sdk.dll.lib" -Destination "bin/win-x64/tribufu_sdk.lib"
|
|
||||||
Copy-Item -Path "target/debug/tribufu_sdk.dll" -Destination "bin/win-x64/tribufu_sdk.dll"
|
|
||||||
|
|
||||||
msbuild /p:Configuration="debug" /p:Platform="win-x64"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
call .\vendor\premake-core\windows\premake5.exe vs2022
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tribufu-constants"
|
|
||||||
version = "0.0.5"
|
|
||||||
description = "Tribufu Constants"
|
|
||||||
repository = "https://github.com/tribufu/tribufu-rust"
|
|
||||||
authors = ["Tribufu <contact@tribufu.com>"]
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tribufu_constants"
|
|
||||||
crate-type = ["rlib"]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
vergen = { version = "=5.1.5", default-features = false, features = [
|
|
||||||
"build",
|
|
||||||
"cargo",
|
|
||||||
"rustc",
|
|
||||||
] }
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use vergen::{vergen, Config};
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
vergen(Config::default()).unwrap();
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use std::env::consts;
|
|
||||||
|
|
||||||
pub const BUILD_TIMESTAMP: &'static str = env!("VERGEN_BUILD_TIMESTAMP");
|
|
||||||
pub const CARGO_PROFILE: &'static str = env!("VERGEN_CARGO_PROFILE");
|
|
||||||
pub const LLVM_VERSION: &'static str = env!("VERGEN_RUSTC_LLVM_VERSION");
|
|
||||||
pub const RUSTC_CHANNEL: &'static str = env!("VERGEN_RUSTC_CHANNEL");
|
|
||||||
pub const RUSTC_COMMIT: &'static str = env!("VERGEN_RUSTC_COMMIT_HASH");
|
|
||||||
pub const RUSTC_VERSION: &'static str = env!("VERGEN_RUSTC_SEMVER");
|
|
||||||
pub const TARGET_ARCH: &'static str = consts::ARCH;
|
|
||||||
pub const TARGET_DLL_EXTENSION: &'static str = consts::DLL_EXTENSION;
|
|
||||||
pub const TARGET_DLL_SUFFIX: &'static str = consts::DLL_SUFFIX;
|
|
||||||
pub const TARGET_EXE_EXTENSION: &'static str = consts::EXE_EXTENSION;
|
|
||||||
pub const TARGET_EXE_SUFFIX: &'static str = consts::EXE_SUFFIX;
|
|
||||||
pub const TARGET_FAMILY: &'static str = consts::FAMILY;
|
|
||||||
pub const TARGET_OS: &'static str = consts::OS;
|
|
||||||
pub const TARGET_TRIPLE: &'static str = env!("VERGEN_CARGO_TARGET_TRIPLE");
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tribufu-error"
|
|
||||||
version = "0.0.5"
|
|
||||||
description = "Tribufu Error"
|
|
||||||
repository = "https://github.com/tribufu/tribufu-rust"
|
|
||||||
authors = ["Tribufu <contact@tribufu.com>"]
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tribufu_error"
|
|
||||||
crate-type = ["rlib"]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
anyhow = "1.0.44"
|
|
||||||
thiserror = "2.0.12"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
pub use anyhow::Error;
|
|
||||||
pub use thiserror::Error;
|
|
||||||
|
|
||||||
pub type Result<T> = core::result::Result<T, Error>;
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tribufu-json"
|
|
||||||
version = "0.0.5"
|
|
||||||
description = "Tribufu Json"
|
|
||||||
repository = "https://github.com/tribufu/tribufu-rust"
|
|
||||||
authors = ["Tribufu <contact@tribufu.com>"]
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tribufu_json"
|
|
||||||
crate-type = ["rlib"]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tribufu-error = { version = "0.0.5", path = "../error" }
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde_json = "1.0"
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use serde::Serialize;
|
|
||||||
use serde_json::ser::PrettyFormatter;
|
|
||||||
use serde_json::Serializer;
|
|
||||||
use tribufu_error::Result;
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! include_json {
|
|
||||||
($path:expr) => {
|
|
||||||
$crate::from_str(include_str!($path)).expect("Failed to load JSON")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub use serde_json::from_slice;
|
|
||||||
pub use serde_json::from_str;
|
|
||||||
pub use serde_json::to_string;
|
|
||||||
pub use serde_json::to_value;
|
|
||||||
pub use serde_json::to_vec_pretty;
|
|
||||||
|
|
||||||
pub fn to_string_pretty<T>(value: &T) -> Result<String>
|
|
||||||
where
|
|
||||||
T: Serialize,
|
|
||||||
{
|
|
||||||
let obj = to_value(value).expect("Failed to serialize JSON");
|
|
||||||
let mut buf = Vec::new();
|
|
||||||
let fmt = PrettyFormatter::with_indent(b" ");
|
|
||||||
let mut ser = Serializer::with_formatter(&mut buf, fmt);
|
|
||||||
obj.serialize(&mut ser)?;
|
|
||||||
Ok(String::from_utf8(buf)?)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
struct JsonTest {
|
|
||||||
version: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_include_json() {
|
|
||||||
let data: JsonTest = include_json!("test.json");
|
|
||||||
assert!(data.version == "0.0.0".to_owned())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.0.0"
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
use crate::apis::configuration::{ApiKey, Configuration};
|
use crate::apis::configuration::{ApiKey, Configuration};
|
||||||
use crate::apis::tribufu_generated_api::TribufuGeneratedApiClient;
|
use crate::apis::tribufu_generated_api::TribufuGeneratedApiClient;
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use tribufu_constants::{RUSTC_VERSION, TARGET_TRIPLE};
|
|
||||||
use std::env::{self, consts};
|
use std::env::{self, consts};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ impl TribufuApi {
|
|||||||
/// Gets the user agent string for the Tribufu API client.
|
/// Gets the user agent string for the Tribufu API client.
|
||||||
pub fn get_user_agent() -> String {
|
pub fn get_user_agent() -> String {
|
||||||
let version = Self::get_version();
|
let version = Self::get_version();
|
||||||
format!("Tribufu/{} (Rust {}; {})", version, RUSTC_VERSION, TARGET_TRIPLE)
|
format!("Tribufu/{} ({}; {})", version, consts::OS, consts::ARCH)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if debug mode is enabled.
|
/// Checks if debug mode is enabled.
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tribufu-log"
|
|
||||||
version = "0.0.5"
|
|
||||||
description = "Tribufu Log"
|
|
||||||
repository = "https://github.com/tribufu/tribufu-rust"
|
|
||||||
authors = ["Tribufu <contact@tribufu.com>"]
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tribufu_log"
|
|
||||||
crate-type = ["rlib"]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tribufu-error = { version = "0.0.5", path = "../error" }
|
|
||||||
chrono = "0.4.23"
|
|
||||||
env_logger = "0.10.1"
|
|
||||||
log = "0.4"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
pub const BLACK: u8 = 0;
|
|
||||||
pub const RED: u8 = 1;
|
|
||||||
pub const GREEN: u8 = 2;
|
|
||||||
pub const YELLOW: u8 = 3;
|
|
||||||
pub const BLUE: u8 = 4;
|
|
||||||
pub const MAGENTA: u8 = 5;
|
|
||||||
pub const CYAN: u8 = 6;
|
|
||||||
pub const WHITE: u8 = 7;
|
|
||||||
pub const BRIGHT_BLACK: u8 = 8;
|
|
||||||
pub const BRIGHT_RED: u8 = 9;
|
|
||||||
pub const BRIGHT_GREEN: u8 = 10;
|
|
||||||
pub const BRIGHT_YELLOW: u8 = 11;
|
|
||||||
pub const BRIGHT_BLUE: u8 = 12;
|
|
||||||
pub const BRIGHT_MAGENTA: u8 = 13;
|
|
||||||
pub const BRIGHT_CYAN: u8 = 14;
|
|
||||||
pub const BRIGHT_WHITE: u8 = 15;
|
|
||||||
118
src/log/lib.rs
118
src/log/lib.rs
@@ -1,118 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use chrono::prelude::*;
|
|
||||||
pub use env_logger::fmt::Color;
|
|
||||||
use env_logger::{Builder, Target};
|
|
||||||
pub use log::debug;
|
|
||||||
pub use log::error;
|
|
||||||
pub use log::info;
|
|
||||||
pub use log::trace;
|
|
||||||
pub use log::warn;
|
|
||||||
use log::Level;
|
|
||||||
use log::LevelFilter;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
pub mod colors;
|
|
||||||
|
|
||||||
mod log_config;
|
|
||||||
pub use log_config::*;
|
|
||||||
|
|
||||||
pub fn init() {
|
|
||||||
let logger = Logger::from_env(None);
|
|
||||||
logger.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init_level(level: LogLevel) {
|
|
||||||
let logger = Logger::new(level.into());
|
|
||||||
logger.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Debug, Copy, Clone, Serialize, Deserialize)]
|
|
||||||
#[serde(rename_all = "lowercase")]
|
|
||||||
pub enum LogLevel {
|
|
||||||
#[default]
|
|
||||||
Off,
|
|
||||||
Error,
|
|
||||||
Warn,
|
|
||||||
Info,
|
|
||||||
Debug,
|
|
||||||
Trace,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LogLevel {
|
|
||||||
pub fn from_str(s: &str) -> Option<Self> {
|
|
||||||
match s {
|
|
||||||
"off" => Some(Self::Off),
|
|
||||||
"error" => Some(Self::Error),
|
|
||||||
"warn" => Some(Self::Warn),
|
|
||||||
"info" => Some(Self::Info),
|
|
||||||
"debug" => Some(Self::Debug),
|
|
||||||
"trace" => Some(Self::Trace),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<LogLevel> for LevelFilter {
|
|
||||||
fn from(level: LogLevel) -> Self {
|
|
||||||
match level {
|
|
||||||
LogLevel::Off => LevelFilter::Off,
|
|
||||||
LogLevel::Error => LevelFilter::Error,
|
|
||||||
LogLevel::Warn => LevelFilter::Warn,
|
|
||||||
LogLevel::Info => LevelFilter::Info,
|
|
||||||
LogLevel::Debug => LevelFilter::Debug,
|
|
||||||
LogLevel::Trace => LevelFilter::Trace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Logger {
|
|
||||||
builder: Builder,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Logger {
|
|
||||||
pub fn new(level: LevelFilter) -> Self {
|
|
||||||
let mut builder = Builder::new();
|
|
||||||
builder.filter_level(level);
|
|
||||||
Self { builder }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_config(config: LogConfig) -> Self {
|
|
||||||
let mut builder = Builder::new();
|
|
||||||
builder.filter_level(config.level.into());
|
|
||||||
Self { builder }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_env(var: Option<String>) -> Self {
|
|
||||||
let builder = Builder::from_env(var.unwrap_or("LOG_LEVEL".to_string()));
|
|
||||||
Self { builder }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init(mut self) {
|
|
||||||
self.builder
|
|
||||||
.target(Target::Stdout)
|
|
||||||
.format(|fmt, record| {
|
|
||||||
let mut style = fmt.style();
|
|
||||||
|
|
||||||
match record.level() {
|
|
||||||
Level::Error => style.set_color(Color::Ansi256(colors::RED)),
|
|
||||||
Level::Warn => style.set_color(Color::Ansi256(colors::YELLOW)),
|
|
||||||
Level::Info => style.set_color(Color::Ansi256(colors::GREEN)),
|
|
||||||
Level::Debug => style.set_color(Color::Ansi256(colors::WHITE)),
|
|
||||||
Level::Trace => style.set_color(Color::Ansi256(colors::BRIGHT_BLACK)),
|
|
||||||
};
|
|
||||||
|
|
||||||
let line = format!(
|
|
||||||
"[{}] [{}]: {}",
|
|
||||||
Local::now().format("%Y-%m-%dT%H:%M:%S"),
|
|
||||||
record.level(),
|
|
||||||
record.args()
|
|
||||||
);
|
|
||||||
|
|
||||||
writeln!(fmt, "{}", style.value(line))
|
|
||||||
})
|
|
||||||
.init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use crate::LogLevel;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::env;
|
|
||||||
use tribufu_error::Result;
|
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct LogConfig {
|
|
||||||
pub level: LogLevel,
|
|
||||||
pub file: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LogConfig {
|
|
||||||
pub fn from_env() -> Result<Self> {
|
|
||||||
Ok(Self {
|
|
||||||
level: LogLevel::from_str(&env::var("LOG_LEVEL")?).unwrap_or_default(),
|
|
||||||
file: env::var("LOG_FILE").ok(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tribufu-sdk"
|
|
||||||
version = "0.0.0"
|
|
||||||
description = "Tribufu Native"
|
|
||||||
repository = "https://github.com/tribufu/tribufu-rust"
|
|
||||||
authors = ["Tribufu <contact@tribufu.com>"]
|
|
||||||
license = "UNLICENSED"
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tribufu_sdk"
|
|
||||||
crate-type = ["rlib", "cdylib", "staticlib"]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tribufu = { path = "../../" }
|
|
||||||
futures = "0.3.31"
|
|
||||||
libc = "0.2.172"
|
|
||||||
once_cell = "1.19.0"
|
|
||||||
tokio = { version = "1.45.1", features = ["full"] }
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
|
|
||||||
use crate::models::{TribufuApiCallbackContext, TribufuApiGetUserInfoCallback};
|
|
||||||
use futures::lock::Mutex;
|
|
||||||
use libc::{c_char, c_void};
|
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use std::ffi::CString;
|
|
||||||
use std::ptr;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use tribufu::apis::tribufu_generated_api::TribufuGeneratedApiClient;
|
|
||||||
use tribufu::TribufuApi;
|
|
||||||
|
|
||||||
static INSTANCE: Lazy<Mutex<Option<TribufuGeneratedApiClient>>> = Lazy::new(|| Mutex::new(None));
|
|
||||||
static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().unwrap());
|
|
||||||
|
|
||||||
/// Gets the version of the Tribufu API.
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn tribufu_api_get_version() -> *const c_char {
|
|
||||||
CString::new(TribufuApi::get_version()).unwrap().into_raw()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the user agent string for the Tribufu API.
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn tribufu_api_get_user_agent() -> *const c_char {
|
|
||||||
CString::new(TribufuApi::get_user_agent())
|
|
||||||
.unwrap()
|
|
||||||
.into_raw()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initialize the Tribufu API instance.
|
|
||||||
///
|
|
||||||
/// This must be called before any other API functions.
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn tribufu_api_initialize() -> bool {
|
|
||||||
let api = TribufuApi::from_env_or_default(None);
|
|
||||||
|
|
||||||
if INSTANCE.try_lock().is_none() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut instance = INSTANCE.try_lock().unwrap();
|
|
||||||
*instance = Some(api);
|
|
||||||
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Shutdown the Tribufu API instance.
|
|
||||||
///
|
|
||||||
/// This must be called when the API is no longer needed.
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn tribufu_api_shutdown() {
|
|
||||||
if INSTANCE.try_lock().is_none() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut instance = INSTANCE.try_lock().unwrap();
|
|
||||||
*instance = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
pub extern "C" fn tribufu_api_get_user_info(
|
|
||||||
context: *mut c_void,
|
|
||||||
callback: TribufuApiGetUserInfoCallback,
|
|
||||||
) {
|
|
||||||
let context = TribufuApiCallbackContext(context);
|
|
||||||
|
|
||||||
RUNTIME.spawn(async move {
|
|
||||||
let mut instance = INSTANCE.lock().await;
|
|
||||||
if instance.is_none() {
|
|
||||||
callback(context.as_ptr(), ptr::null());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let api = instance.as_mut();
|
|
||||||
if api.is_none() {
|
|
||||||
callback(context.as_ptr(), ptr::null());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let api = api.unwrap();
|
|
||||||
|
|
||||||
// TODO: Implement logic here
|
|
||||||
|
|
||||||
callback(context.as_ptr(), ptr::null());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
pub mod api;
|
|
||||||
pub mod mem;
|
|
||||||
pub mod models;
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
|
|
||||||
use std::ffi::CString;
|
|
||||||
use std::os::raw::c_char;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn tribufu_free_string(ptr: *mut c_char) {
|
|
||||||
if ptr.is_null() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let _ = CString::from_raw(ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use libc::c_void;
|
|
||||||
|
|
||||||
pub struct TribufuApiCallbackContext(pub(crate) *mut c_void);
|
|
||||||
|
|
||||||
impl TribufuApiCallbackContext {
|
|
||||||
pub(crate) fn as_ptr(&self) -> *mut c_void {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl Send for TribufuApiCallbackContext {}
|
|
||||||
unsafe impl Sync for TribufuApiCallbackContext {}
|
|
||||||
|
|
||||||
pub type TribufuApiGetUserInfoCallbackData = c_void;
|
|
||||||
pub type TribufuApiGetUserInfoCallback =
|
|
||||||
extern "C" fn(*mut c_void, *const TribufuApiGetUserInfoCallbackData);
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tribufu-platform"
|
|
||||||
version = "0.0.5"
|
|
||||||
description = "Tribufu Platform"
|
|
||||||
repository = "https://github.com/tribufu/tribufu-rust"
|
|
||||||
authors = ["Tribufu <contact@tribufu.com>"]
|
|
||||||
edition = "2021"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tribufu_platform"
|
|
||||||
crate-type = ["rlib"]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tribufu-error = { version = "0.0.5", path = "../error" }
|
|
||||||
dunce = "1.0.4"
|
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))'.dependencies]
|
|
||||||
dirs = "5.0.1"
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
pub mod paths;
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use tribufu_error::Result;
|
|
||||||
|
|
||||||
/// Gets the root base directory of the application.
|
|
||||||
pub fn app_dir() -> Result<PathBuf> {
|
|
||||||
let mut path = dunce::canonicalize(env::current_exe()?)?; // /bin/platform/app.exe
|
|
||||||
path.pop(); // /bin
|
|
||||||
path.pop(); // /
|
|
||||||
Ok(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the path to the platform-specific binary directory.
|
|
||||||
pub fn bin_dir() -> Result<PathBuf> {
|
|
||||||
let base_dir = app_dir()?;
|
|
||||||
|
|
||||||
#[cfg(all(target_os = "macos", not(debug_assertions)))]
|
|
||||||
return Ok(base_dir.join("MacOS"));
|
|
||||||
|
|
||||||
#[cfg(not(all(target_os = "macos", not(debug_assertions))))]
|
|
||||||
Ok(base_dir.join("bin"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the path to the configuration directory.
|
|
||||||
pub fn config_dir() -> Result<PathBuf> {
|
|
||||||
Ok(app_dir()?.join("config"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the path to the assets directory.
|
|
||||||
pub fn assets_dir() -> Result<PathBuf> {
|
|
||||||
Ok(app_dir()?.join("assets"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the path to the saved data directory.
|
|
||||||
pub fn saved_dir() -> Result<PathBuf> {
|
|
||||||
Ok(app_dir()?.join("saved"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the path to the cache directory inside `saved`.
|
|
||||||
pub fn cache_dir() -> Result<PathBuf> {
|
|
||||||
Ok(saved_dir()?.join("cache"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the path to the logs directory inside `saved`.
|
|
||||||
pub fn logs_dir() -> Result<PathBuf> {
|
|
||||||
Ok(saved_dir()?.join("logs"))
|
|
||||||
}
|
|
||||||
27
vendor/premake-core/LICENSE.txt
vendored
27
vendor/premake-core/LICENSE.txt
vendored
@@ -1,27 +0,0 @@
|
|||||||
Copyright (c) 2003-2022 Jason Perkins and individual contributors.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of Premake nor the names of its contributors may be
|
|
||||||
used to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
BIN
vendor/premake-core/linux/libluasocket.so
vendored
BIN
vendor/premake-core/linux/libluasocket.so
vendored
Binary file not shown.
BIN
vendor/premake-core/linux/premake5
vendored
BIN
vendor/premake-core/linux/premake5
vendored
Binary file not shown.
BIN
vendor/premake-core/mac/libluasocket.dylib
vendored
BIN
vendor/premake-core/mac/libluasocket.dylib
vendored
Binary file not shown.
BIN
vendor/premake-core/mac/premake5
vendored
BIN
vendor/premake-core/mac/premake5
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.dll
vendored
BIN
vendor/premake-core/windows/luasocket.dll
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.exp
vendored
BIN
vendor/premake-core/windows/luasocket.exp
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.lib
vendored
BIN
vendor/premake-core/windows/luasocket.lib
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/luasocket.pdb
vendored
BIN
vendor/premake-core/windows/luasocket.pdb
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/premake5.exe
vendored
BIN
vendor/premake-core/windows/premake5.exe
vendored
Binary file not shown.
BIN
vendor/premake-core/windows/premake5.pdb
vendored
BIN
vendor/premake-core/windows/premake5.pdb
vendored
Binary file not shown.
Reference in New Issue
Block a user