mirror of https://github.com/dnomd343/ClearDNS
Dnomd343
2 years ago
2 changed files with 14 additions and 8 deletions
@ -1,18 +1,24 @@ |
|||||
#include <stdio.h> |
#include <stdio.h> |
||||
|
#include <string.h> |
||||
#include "to_json.h" |
#include "to_json.h" |
||||
|
|
||||
int main() { |
int main() { |
||||
printf("start demo\n"); |
printf("start demo\n"); |
||||
|
|
||||
char raw_string[] = "hello"; |
char yaml_string[] = "test: ok\narray:\n - 123\n - 234\n - 345\n"; |
||||
|
printf("----------------\n"); |
||||
|
printf("%s", yaml_string); |
||||
|
printf("----------------\n"); |
||||
|
|
||||
const char *json_content = to_json_rust(raw_string); |
const char *raw_json_string = to_json_rust(yaml_string); |
||||
|
char *json_string = strdup(raw_json_string); |
||||
|
|
||||
printf("return content -> `%s`\n", json_content); |
printf("----------------\n"); |
||||
|
printf("%s\n", json_string); |
||||
|
printf("----------------\n"); |
||||
|
|
||||
free_rust_string(json_content); |
free_rust_string(raw_json_string); |
||||
|
printf("rust string free complete\n"); |
||||
printf("rust string free success\n"); |
|
||||
|
|
||||
return 0; |
return 0; |
||||
} |
} |
||||
|
Loading…
Reference in new issue