Skip to content

Commit 392bdd2

Browse files
shadowfactsbitwalker
authored andcommitted
Re-add missing headers
1 parent 9966a18 commit 392bdd2

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#pragma once
2+
3+
#include "Support.h"
4+
5+
typedef uint32_t NodeRef;
6+
typedef uint32_t AttributeRef;
7+
8+
typedef struct __Document {
9+
void *ptr;
10+
} __Document;
11+
12+
typedef struct __Element {
13+
_RustStr ns;
14+
_RustStr tag;
15+
_RustSlice attributes;
16+
} __Element;
17+
18+
typedef struct __Attribute {
19+
_RustStr ns;
20+
_RustStr name;
21+
_RustStr value;
22+
} __Attribute;
23+
24+
enum __NodeType {
25+
NodeTypeRoot = 0,
26+
NodeTypeElement = 1,
27+
NodeTypeLeaf = 2,
28+
} __attribute__((enum_extensibility(closed)));
29+
30+
typedef enum __NodeType __NodeType;
31+
32+
typedef union __NodeData {
33+
void *root;
34+
__Element element;
35+
_RustStr leaf;
36+
} __NodeData;
37+
38+
typedef struct __Node {
39+
__NodeType ty;
40+
__NodeData data;
41+
} __Node;
42+
43+
extern _RustString __liveview_native_core$Document$to_string(__Document doc);
44+
45+
extern __Document __liveview_native_core$Document$empty();
46+
47+
extern void __liveview_native_core$Document$drop(__Document doc);
48+
49+
extern _RustResult __liveview_native_core$Document$parse(_RustStr text,
50+
_RustString *error);
51+
52+
extern bool __liveview_native_core$Document$merge(__Document doc,
53+
__Document other);
54+
55+
extern NodeRef __liveview_native_core$Document$root(__Document doc);
56+
57+
extern __Node __liveview_native_core$Document$get(__Document doc, NodeRef node);
58+
59+
extern _RustSlice __liveview_native_core$Document$children(__Document doc,
60+
NodeRef node);
61+
62+
extern _RustSlice __liveview_native_core$Document$attributes(__Document doc,
63+
NodeRef node);
64+
65+
extern __Attribute
66+
__liveview_native_core$Document$get_attribute(__Document doc,
67+
AttributeRef attr);

crates/core/c_src/include/Support.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#pragma once
2+
3+
#include <stdbool.h>
4+
5+
#if defined(_WIN32)
6+
typedef unsigned char uint8_t;
7+
typedef uint8_t u_int8_t;
8+
typedef unsigned short uint16_t;
9+
typedef uint16_t u_int16_t;
10+
typedef unsigned uint32_t;
11+
typedef uint32_t u_int32_t;
12+
typedef unsigned long long uint64_t;
13+
typedef uint64_t u_int64_t;
14+
#else
15+
#include <stdint.h>
16+
#endif
17+
18+
typedef struct _RustResult {
19+
bool is_ok;
20+
void *ok_result;
21+
} _RustResult;
22+
23+
typedef struct _RustSlice {
24+
const void *start;
25+
uintptr_t len;
26+
} _RustSlice;
27+
28+
typedef struct _RustStr {
29+
const void *start;
30+
uintptr_t len;
31+
} _RustStr;
32+
33+
extern bool __liveview_native_core$RustStr$eq(_RustStr lhs, _RustStr rhs);
34+
extern bool __liveview_native_core$RustStr$lt(_RustStr lhs, _RustStr rhs);
35+
36+
typedef struct _RustString {
37+
const void *start;
38+
uintptr_t len;
39+
uintptr_t capacity;
40+
} _RustString;
41+
42+
extern void __liveview_native_core$RustString$drop(_RustString string);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module liveview_native_core {
2+
header "Support.h"
3+
header "LiveViewNativeCore.h"
4+
export *
5+
}

0 commit comments

Comments
 (0)