在Rust中,可以使用自定义section的方式,将一些数据(比如函数信息)保存到二进制文件中,可以实现类似反射的能力,代码如下。
1 | type ELEMENT = (&'static str, fn(i32, i32) -> i32); |
- 本文作者: killf
- 本文链接: https://www.killf.info/编程语言/Rust/Rust中的自定义section/
- 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true