当前位置: 首页 > news >正文

无锡网站建设设计公司wordpress页面怎么加入php网页

无锡网站建设设计公司,wordpress页面怎么加入php网页,企业手机网站,app下载我的订单91.将指针还原成指定类型 因为指针不知道里面具体有什么,所以一般约定打上unsafe 申明开发者自己对该部分可用性负责,且在调试的时候也能起强调作用 // tests6.rs // // In this example we take a shallow dive into the Rust standard librarys // unsafe functions. Fix …91.将指针还原成指定类型 因为指针不知道里面具体有什么,所以一般约定打上unsafe 申明开发者自己对该部分可用性负责,且在调试的时候也能起强调作用 // tests6.rs // // In this example we take a shallow dive into the Rust standard librarys // unsafe functions. Fix all the question marks and todos to make the test // pass. // // Execute rustlings hint tests6 or use the hint watch subcommand for a // hint.// I AM NOT DONEstruct Foo {a: u128,b: OptionString, }/// # Safety /// /// The ptr must contain an owned box of Foo. unsafe fn raw_pointer_to_box(ptr: *mut Foo) - BoxFoo {// SAFETY: The ptr contains an owned box of Foo by contract. We// simply reconstruct the box from that pointer.let mut ret: BoxFoo unsafe { Box::from_raw(ptr) };// todo!(The rest of the code goes here)ret.b Some(hello.to_owned());ret }#[cfg(test)] mod tests {use super::*;use std::time::Instant;#[test]fn test_success() {let data Box::new(Foo { a: 1, b: None });let ptr_1 data.a as *const u128 as usize;// SAFETY: We pass an owned box of Foo.let ret unsafe { raw_pointer_to_box(Box::into_raw(data)) };let ptr_2 ret.a as *const u128 as usize;assert!(ptr_1 ptr_2);assert!(ret.b Some(hello.to_owned()));} }92.配置本地环境 首先我们得知道配置文件放在build.rs里面!!! 首先参考文档之后写上指令 rustc-envTEST_FOO{}, 然后注释掉下面的 your_command变量即可通过test7 93. 函数签名设置编译参数 这个标签指定了编译的配置参数key-value 设置编译的key-value即可,详情参照文档 let your_command rustc-cfgfeature \pass\; 94.设置#[link_name myName]和#[no_mangle]获取原汁原味特定的函数名 有时候经过名称修饰或者编译,函数名会发生变化,在同语言下没有影响,但是在不同语言交互的时候可能会找不到指定的函数名,所以将函数名称固定可以避免此种情况发生 // tests9.rs // // Rust is highly capable of sharing FFI interfaces with C/C and other statically compiled // languages, and it can even link within the code itself! It makes it through the extern // block, just like the code below. // // The short string after the extern keyword indicates which ABI the externally imported // function would follow. In this exercise, Rust is used, while other variants exists like // C for standard C ABI, stdcall for the Windows ABI. // // The externally imported functions are declared in the extern blocks, with a semicolon to // mark the end of signature instead of curly braces. Some attributes can be applied to those // function declarations to modify the linking behavior, such as #[link_name ..] to // modify the actual symbol names. // // If you want to export your symbol to the linking environment, the extern keyword can // also be marked before a function definition with the same ABI string note. The default ABI // for Rust functions is literally Rust, so if you want to link against pure Rust functions, // the whole extern term can be omitted. // // Rust mangles symbols by default, just like C does. To suppress this behavior and make // those functions addressable by name, the attribute #[no_mangle] can be applied. // // In this exercise, your task is to make the testcase able to call the my_demo_function in // module Foo. the my_demo_function_alias is an alias for my_demo_function, so the two // line of code in the testcase should call the same function. // // You should NOT modify any existing code except for adding two lines of attributes.// I AM NOT DONEextern Rust {fn my_demo_function(a: u32) - u32;#[link_name my_demo_function]fn my_demo_function_alias(a: u32) - u32; }mod Foo {#[no_mangle]// No extern equals extern Rust.fn my_demo_function(a: u32) - u32 {a} }#[cfg(test)] mod tests {use super::*;#[test]fn test_success() {// The externally imported functions are UNSAFE by default// because of untrusted source of other languages. You may// wrap them in safe Rust APIs to ease the burden of callers.//// SAFETY: We know those functions are aliases of a safe// Rust function.unsafe {my_demo_function(123);my_demo_function_alias(456);}} }ok完结
http://www.huolong8.cn/news/20827/

相关文章:

  • 高端网站建设 来磐石网络自己做的网站打开速度慢
  • 网站建设及优化重要性西安建设学院网站首页
  • 网站开发就业前景企业管理培训公司排行榜
  • 网站免费申请空间wordpress怎么安装在nginx下
  • 沧州网站设计一级建造师招聘网最新招聘
  • 做视频官方网站小程序免费制作平台教学
  • 天津网站制作费用网页版游戏排行榜4399
  • 宣讲家网站支部建设长沙app软件制作
  • cms 类网站中学网站建设 课设
  • 如何给客户做网站方案wordpress 从哪儿登录
  • 赛事竞猜网站开发wordpress插件地图标记
  • 深圳免费网站排名优化wordpress 链接扁平化
  • 哪个网站教做ppt模板网站建设试题
  • 网站设计公司行业排名wordpress换域名主题
  • 南京网站制作千网站域名做链接怎么做
  • 广州网站建设服务电话做贸易把产品放到哪个网站好呢
  • 网络公司有哪些职位网站模板对seo的影响
  • 端州网站建设大连网站建设收费
  • 开发网站公司价格湖南省金力电力建设有限公司 网站
  • 用手机搭建自己的网站西安网站开发高端网站开发
  • 网站模板怎么设计网站备案完电信
  • 湖北皇奥建设工程有限公司网站泰安网络犯罪案件
  • 仙桃网站设计公司辽宁建设工程招标信息网官网
  • 2021年新闻大事件什么样的网站好优化
  • 亚马逊网站建设评述杭州公司注销流程及费用
  • 正规建网站企业建设厅网站举报
  • 死链对网站的影响巨量算数数据分析
  • 广告 网站举例创新的模板网站建设
  • 婚庆公司网站模板下载建设专业网站
  • 贸易公司做网站有优势吗大数据开发过程