Rust Code Hide Testing

Jan. 21, 2022, edited on Mar. 21, 2023

在 Rust 代码块的行首添加 # 号:

# use std::ffi::c_void;
# 
# use sb7::application::Application;
# struct App;
# 
# impl Application for App {
#   fn startup(&mut self) {
#     unsafe {
      let mut buf = 0;
      let mut data = Vec::from("hello world");
      data.resize(1024 * 1024, 0);

      gl::CreateBuffers(1, &mut buf);
      {
        let data = data.as_ptr() as *const c_void;
        gl::NamedBufferStorage(buf, 1024 * 1024, data, gl::DYNAMIC_STORAGE_BIT);
      }
#     }
#   }
# }
# 
# fn main() {
#   App.run()
# }

渲染结果:

# use std::ffi::c_void;
# 
# use sb7::application::Application;
# struct App;
# 
# impl Application for App {
#   fn startup(&mut self) {
#     unsafe {
      let mut buf = 0;
      let mut data = Vec::from("hello world");
      data.resize(1024 * 1024, 0);

      gl::CreateBuffers(1, &mut buf);
      {
        let data = data.as_ptr() as *const c_void;
        gl::NamedBufferStorage(buf, 1024 * 1024, data, gl::DYNAMIC_STORAGE_BIT);
      }
#     }
#   }
# }
# 
# fn main() {
#   App.run()
# }

可以显示 / 隐藏代码.