-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
2 lines (2 loc) · 38.3 KB
/
index.html
1
2
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="keywords" content="Blog"><meta name="author" content="TwoSix"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link rel="preconnect" href="https://registry.npmmirror.com" crossorigin><link rel="canonical" href="https://twosix.page/"><meta name="robots" content="index,follow"><meta name="googlebot" content="index,follow"><meta name="revisit-after" content="1 days"><meta name="description" content="无无聊聊,简简单单"><meta property="og:type" content="website"><meta property="og:title" content="TwoSix的小木屋"><meta property="og:url" content="https://twosix.page/index.html"><meta property="og:site_name" content="TwoSix的小木屋"><meta property="og:description" content="无无聊聊,简简单单"><meta property="og:locale" content="zh_CN"><meta property="article:author" content="TwoSix"><meta property="article:tag" content="Blog"><meta name="twitter:card" content="summary"><link rel="icon" type="image/png" href="/images/logo.ico" sizes="192x192"><link rel="apple-touch-icon" sizes="180x180" href="/images/logo.ico"><meta name="theme-color" content="#9d5da2"><link rel="shortcut icon" href="/images/logo.ico"><title>TwoSix的小木屋 - 无无聊聊简简单单</title><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fonts/Chillax/chillax.css"><script data-swup-reload-script defer src="https://umami.2626666.xyz/script.js" data-website-id="1febf3b2-6f24-4ac8-a6ff-458478feafb9"></script><meta name="baidu-site-verification" content="codeva-t9TDxWNwbp"><link rel="stylesheet" href="/css/style.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/css/build/tailwind.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fonts/GeistMono/geist-mono.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fonts/Geist/geist.css"><script id="hexo-configurations">window.config={hostname:"twosix.page",root:"/",language:"zh-CN",path:"search.xml"},window.theme={articles:{style:{font_size:"16px",line_height:1.5,image_border_radius:"14px",image_alignment:"center",image_caption:!1,link_icon:!0,delete_mask:!1,title_alignment:"left",headings_top_spacing:{h1:"3.2rem",h2:"2.4rem",h3:"1.9rem",h4:"1.6rem",h5:"1.4rem",h6:"1.3rem"}},word_count:{enable:!0,count:!0,min2read:!0},author_label:{enable:!0,auto:!1,list:[]},code_block:{copy:!0,style:"mac",highlight_theme:{light:"github",dark:"vs2015"},font:{enable:!1,family:null,url:null}},toc:{enable:!0,max_depth:3,number:!1,expand:!0,init_open:!0},copyright:{enable:!0,default:"cc_by_nc_sa"},lazyload:!0,pangu_js:!0,recommendation:{enable:!1,title:"推荐阅读",limit:3,mobile_limit:2,placeholder:"/images/wallhaven-wqery6-light.webp",skip_dirs:[]}},colors:{primary:"#9d5da2",secondary:null,default_mode:"light"},global:{fonts:{chinese:{enable:!1,family:null,url:null},english:{enable:!1,family:null,url:null},title:{enable:!1,family:null,url:null}},content_max_width:"1000px",sidebar_width:"210px",hover:{shadow:!0,scale:!0},scroll_progress:{bar:!1,percentage:!0},website_counter:{url:"https://cn.vercount.one/js",enable:!0,site_pv:!0,site_uv:!0,post_pv:!0},single_page:!0,preloader:{enable:!1,custom_message:null},open_graph:!0,google_analytics:{enable:!1,id:null}},home_banner:{enable:!0,style:"fixed",image:{light:"/images/background.webp",dark:"/images/background.webp"},title:"TwoSix的小木屋",subtitle:{text:["Hello World!"],hitokoto:{enable:!1,show_author:!1,api:"https://v1.hitokoto.cn"},typing_speed:100,backing_speed:80,starting_delay:500,backing_delay:1500,loop:!0,smart_backspace:!0},text_color:{light:"#fff",dark:"#d1d1b6"},text_style:{title_size:"2.8rem",subtitle_size:"1.5rem",line_height:1.2},custom_font:{enable:!1,family:null,url:null},social_links:{enable:!0,style:"default",links:{github:"https://github.com/TwooSix",instagram:null,zhihu:null,twitter:null,email:null,"fa-solid fa-envelope":"mailto:[email protected]"},qrs:{weixin:null}}},plugins:{feed:{enable:!1},aplayer:{enable:!1,type:"fixed",audios:[{name:null,artist:null,url:null,cover:null,lrc:null}]},mermaid:{enable:!1,version:"11.4.1"}},version:"2.8.2",navbar:{auto_hide:!0,color:{left:"#4f35a2",right:"#cbd0f6",transparency:35},width:{home:"1200px",pages:"1000px"},links:{Home:{path:"/",icon:"fa-regular fa-house"},"时间线":{path:"/archives",icon:"fa-regular fa-archive"},"追番列表":{path:"/bangumi",icon:"fa-regular fa-tv"},About:{path:"/about",icon:"fa-regular fa-user"}},search:{enable:!0,preload:!0}},page_templates:{friends_column:2,tags_style:"blur"},home:{sidebar:{enable:!0,position:"left",first_item:"info",announcement:null,show_on_mobile:!0,links:null},article_date_format:"auto",excerpt_length:200,categories:{enable:!0,limit:3},tags:{enable:!0,limit:3}},footerStart:"2022/11/26 18:00:00"},window.lang_ago={second:"%s 秒前",minute:"%s 分钟前",hour:"%s 小时前",day:"%s 天前",week:"%s 周前",month:"%s 个月前",year:"%s 年前"},window.data={masonry:!1}</script><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fontawesome/fontawesome.min.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fontawesome/brands.min.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fontawesome/solid.min.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fontawesome/regular.min.css"><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/fontawesome/sharp-solid.min.css"><meta name="generator" content="Hexo 7.3.0"><link rel="alternate" href="/atom.xml" title="TwoSix的小木屋" type="application/atom+xml">
</head><body><div class="progress-bar-container"><span class="pjax-progress-bar"></span></div><main class="page-container" id="swup"><style>.home-banner-container{background:0 0!important}.home-article-item,.right-bottom-tools,.sidebar-content,.sidebar-links,.sidebar-links .links:hover,a.extend,a.page-number,footer.footer{background-color:var(--background-color-transparent-80)!important}.right-bottom-tools:hover,a.extend:hover,a.page-number:hover{background-color:var(--primary-color)!important}.home-article-sticky-label,.site-info{background-color:var(--background-color-transparent-15)!important}.home-article-sticky-label{backdrop-filter:none!important}</style><div class="home-banner-background transition-fade fixed top-0 left-0 w-screen h-screen scale-125 sm:scale-110 box-border will-change-transform bg-cover"><img src="/images/background.webp" alt="home-banner-background" class="w-full h-full object-cover dark:hidden"> <img src="/images/background.webp" alt="home-banner-background" class="w-full h-full object-cover hidden dark:block"></div><div class="home-banner-container flex justify-center items-center transition-fade relative"><div class="content mt-8 flex flex-col justify-center items-center transition-fade-down"><div class="description flex flex-col justify-center items-center w-screen font-medium text-center">TwoSix的小木屋<p><i id="subtitle"></i></p></div><div class="absolute bottom-0.5 flex flex-row justify-between max-w-[1340px] items-center w-full px-8 sm:px-12"><div class="flex p-3 bg-gray-300/50 dark:bg-gray-500/40 backdrop-blur-lg border border-white/20 dark:border-gray-500/30 group rounded-full cursor-pointer flex justify-center items-center aspect-square h-full shadow-redefine-flat hover:shadow-redefine-flat-hover transition-shadow" onclick="scrollToMain()"><i class="fa-solid fa-arrow-down fa-fw fa-lg group-hover:translate-y-1 transition-transform"></i></div><div class="social-contacts px-6 py-3 bg-gray-300/50 dark:bg-gray-500/40 backdrop-blur-lg border border-white/20 dark:border-gray-500/30 shadow-redefine-flat rounded-full flex flex-row gap-3 items-center"><span class="social-contact-item github"><a target="_blank" href="https://github.com/TwooSix"><i class="fa-brands fa-fw fa-lg fa-github"></i> </a></span><span class="social-contact-item"><a target="_blank" href="mailto:[email protected]"><i class="fa-solid fa-envelope fa-fw fa-lg"></i></a></span></div></div></div><script>const scrollToMain=()=>{console.log("scroll");document.querySelector(".main-content-container").scrollIntoView({behavior:"smooth"})}</script></div><div class="main-content-container flex flex-col justify-between min-h-dvh"><div class="main-content-header"><header class="navbar-container px-6 md:px-12"><div class="navbar-content transition-navbar has-home-banner"><div class="left"><a class="logo-title" href="/"><h1>TwoSix的小木屋</h1></a></div><div class="right"><div class="desktop"><ul class="navbar-list"><li class="navbar-item"><a class="active" href="/"><i class="fa-regular fa-house fa-fw"></i> 首页</a></li><li class="navbar-item"><a href="/archives"><i class="fa-regular fa-archive fa-fw"></i> 时间线</a></li><li class="navbar-item"><a href="/bangumi"><i class="fa-regular fa-tv fa-fw"></i> 追番列表</a></li><li class="navbar-item"><a href="/about"><i class="fa-regular fa-user fa-fw"></i> 关于</a></li><li class="navbar-item search search-popup-trigger"><i class="fa-solid fa-magnifying-glass"></i></li></ul></div><div class="mobile"><div class="icon-item search search-popup-trigger"><i class="fa-solid fa-magnifying-glass"></i></div><div class="icon-item navbar-bar"><div class="navbar-bar-middle"></div></div></div></div></div><div class="navbar-drawer h-dvh w-full absolute top-0 left-0 bg-background-color flex flex-col justify-between"><ul class="drawer-navbar-list flex flex-col px-4 justify-center items-start"><li class="drawer-navbar-item text-base my-1.5 flex flex-col w-full"><a class="py-1.5 px-2 flex flex-row items-center justify-between gap-1 hover:!text-primary active:!text-primary text-2xl font-semibold group border-b border-border-color hover:border-primary w-full active" href="/"><span>首页 </span><i class="fa-regular fa-house fa-sm fa-fw"></i></a></li><li class="drawer-navbar-item text-base my-1.5 flex flex-col w-full"><a class="py-1.5 px-2 flex flex-row items-center justify-between gap-1 hover:!text-primary active:!text-primary text-2xl font-semibold group border-b border-border-color hover:border-primary w-full" href="/archives"><span>时间线 </span><i class="fa-regular fa-archive fa-sm fa-fw"></i></a></li><li class="drawer-navbar-item text-base my-1.5 flex flex-col w-full"><a class="py-1.5 px-2 flex flex-row items-center justify-between gap-1 hover:!text-primary active:!text-primary text-2xl font-semibold group border-b border-border-color hover:border-primary w-full" href="/bangumi"><span>追番列表 </span><i class="fa-regular fa-tv fa-sm fa-fw"></i></a></li><li class="drawer-navbar-item text-base my-1.5 flex flex-col w-full"><a class="py-1.5 px-2 flex flex-row items-center justify-between gap-1 hover:!text-primary active:!text-primary text-2xl font-semibold group border-b border-border-color hover:border-primary w-full" href="/about"><span>关于 </span><i class="fa-regular fa-user fa-sm fa-fw"></i></a></li></ul><div class="statistics flex justify-around my-2.5"><a class="item tag-count-item flex flex-col justify-center items-center w-20" href="/tags"><div class="number text-2xl sm:text-xl text-second-text-color font-semibold">4</div><div class="label text-third-text-color text-sm">标签</div></a><a class="item tag-count-item flex flex-col justify-center items-center w-20" href="/categories"><div class="number text-2xl sm:text-xl text-second-text-color font-semibold">2</div><div class="label text-third-text-color text-sm">分类</div></a><a class="item tag-count-item flex flex-col justify-center items-center w-20" href="/archives"><div class="number text-2xl sm:text-xl text-second-text-color font-semibold">17</div><div class="label text-third-text-color text-sm">文章</div></a></div></div><div class="window-mask"></div></header></div><div class="main-content-body transition-fade-up"><div class="home-sidebar-container"><div class="sticky-container sticky"><div class="sidebar-content"><div class="avatar flex justify-center"><img src="/images/logo.webp"></div><div class="author flex flex-col justify-center my-2.5 mx-0"><div class="name">TwoSix</div><div class="label">Lv3</div></div><div class="statistics flex justify-around my-2.5"><a class="item tag-count-item flex flex-col justify-center items-center w-20" href="/tags"><div class="number text-2xl sm:text-xl text-second-text-color font-semibold">4</div><div class="label text-third-text-color text-sm">标签</div></a><a class="item tag-count-item flex flex-col justify-center items-center w-20" href="/categories"><div class="number text-2xl sm:text-xl text-second-text-color font-semibold">2</div><div class="label text-third-text-color text-sm">分类</div></a><a class="item tag-count-item flex flex-col justify-center items-center w-20" href="/archives"><div class="number text-2xl sm:text-xl text-second-text-color font-semibold">17</div><div class="label text-third-text-color text-sm">文章</div></a></div></div></div></div><div class="main-content"><div class="home-content-container"><ul class="home-article-list"><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2024/06/28/%E4%B8%BA%E4%BD%A0%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AA%E8%BF%BD%E7%95%AA%E5%88%97%E8%A1%A8/">为你的hexo博客添加一个追番列表</a></h3><div class="home-article-content markdown-body">本文基于插件hexo-bilibili-bangumi编写,并修改为适配redefine主题的样式,最终结果示例见我的追番列表 主要是闲来无事逛github的时候发现了hexo-bilibili-bangumi这么一个插件,可以爬取bili/bangumi的数据并渲染为一个页面展示你的追番列表,整好我前段时间开始有了bangumi记录追番的习惯,所以想着上...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Fri Jun 28 2024 16:42:06 GMT+0800">2024-06-28 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/%E5%89%8D%E7%AB%AF/">前端</a> </li></ul></span></div><a href="/2024/06/28/%E4%B8%BA%E4%BD%A0%E7%9A%84hexo%E5%8D%9A%E5%AE%A2%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AA%E8%BF%BD%E7%95%AA%E5%88%97%E8%A1%A8/">阅读全文<span class="seo-reader-text">为你的hexo博客添加一个追番列表</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2024/06/27/cmake%E8%B0%83%E7%94%A8windeployqt%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%8A%A8%E6%89%93%E5%8C%85qt%E7%9A%84dll%E6%96%87%E4%BB%B6/">cmake调用windeployqt实现自动打包qt的dll文件</a></h3><div class="home-article-content markdown-body">最近在编写一个Qt项目,发现Qt在windows部署有一个很方便的工具windeployqt.exe,遂研究如何在cmake里调用这个工具,在install时执行,实现全自动化的发布构建。 代码如下: 1234567891011# 1. 找到qmake的执行路径(Qt5请更换为你实际的Qt版本)get_target_property(qmake_exec_filepath Qt5::qmak...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Thu Jun 27 2024 20:11:05 GMT+0800">2024-06-27 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/cmake/">cmake</a> </li></ul></span></div><a href="/2024/06/27/cmake%E8%B0%83%E7%94%A8windeployqt%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%8A%A8%E6%89%93%E5%8C%85qt%E7%9A%84dll%E6%96%87%E4%BB%B6/">阅读全文<span class="seo-reader-text">cmake调用windeployqt实现自动打包qt的dll文件</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2024/01/23/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9114-%E8%BF%9B%E4%B8%80%E6%AD%A5%E8%AE%A4%E8%AF%86Cargo%E5%8F%8Acrates-io/">【Rust 学习记录】14. 进一步认识Cargo及crates.io</a></h3><div class="home-article-content markdown-body">这一章就主要讲讲Cargo这个工具的一些用途,主要是以下几个部分,没有涉猎到的可以在官网查看cargo更全面的介绍: build时使用的release profile相关介绍 怎么将你写的包发布到creates.io上给别人用 使用工作空间组织项目 下载安装craetes.io的包 使用自定义命令来扩展cargo release profileRust内置了两套release profi...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Tue Jan 23 2024 21:55:47 GMT+0800">2024-01-23 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2024/01/23/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9114-%E8%BF%9B%E4%B8%80%E6%AD%A5%E8%AE%A4%E8%AF%86Cargo%E5%8F%8Acrates-io/">阅读全文<span class="seo-reader-text">【Rust 学习记录】14. 进一步认识Cargo及crates.io</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2024/01/18/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9113-%E9%97%AD%E5%8C%85%E4%B8%8E%E8%BF%AD%E4%BB%A3%E5%99%A8/">【Rust 学习记录】13. 闭包与迭代器</a></h3><div class="home-article-content markdown-body">闭包:能够捕获环境的匿名函数如这个小节的标题所示,闭包其实就是一个匿名函数,可以接收变量,也可以返回值,主要是用来实现一些代码复用和自定义的行为。 概述首先,闭包的基本定义方法如下 1234567fn main() { let a = 1; let b = 2; let c = |a, b|{a+b}; let d = |a, b| a-...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Thu Jan 18 2024 20:57:44 GMT+0800">2024-01-18 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2024/01/18/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9113-%E9%97%AD%E5%8C%85%E4%B8%8E%E8%BF%AD%E4%BB%A3%E5%99%A8/">阅读全文<span class="seo-reader-text">【Rust 学习记录】13. 闭包与迭代器</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2023/05/12/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9112-%E7%BC%96%E5%86%99%E4%B8%80%E4%B8%AA%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%A8%8B%E5%BA%8F/">【Rust 学习记录】12. 编写一个命令行程序</a></h3><div class="home-article-content markdown-body">本章节我们将开始学习编写一个小项目——开发一个能够和文件系统交互并处理命令行输入、输出的工具 基本功能实现首先自然是新建一个项目,名为minigrep 1cargo new minigrep 实现这一个工具的首要任务自然是接收命令行的参数,例如我们要实现在一个文件里搜索字符串,就得在运行时接收两个参数,一个待搜索的字符串,一个搜索的文件名,例如 1cargo run string fi...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Fri May 12 2023 21:34:53 GMT+0800">2023-05-12 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2023/05/12/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9112-%E7%BC%96%E5%86%99%E4%B8%80%E4%B8%AA%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%A8%8B%E5%BA%8F/">阅读全文<span class="seo-reader-text">【Rust 学习记录】12. 编写一个命令行程序</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2023/05/09/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9111-%E7%BC%96%E5%86%99%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95/">【Rust 学习记录】11. 编写自动化测试</a></h3><div class="home-article-content markdown-body">这一章讲的就是怎么在Rust编写单元测试代码,这一部分的思想不仅适用于Rust,在绝大多数语言都是有用武之地的 如何编写测试测试代码的构成构成通用测试代码通常包括三个部分 准备所需的数据或者前置状态 调用需要测试的代码 使用断言,判断运行结果是否和我们期望的一致 在Rust中,有专门用于编写测试代码的相关功能,包含test属性,测试宏,should_panic属性等等 在最简单的情况...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Tue May 09 2023 16:00:30 GMT+0800">2023-05-09 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2023/05/09/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9111-%E7%BC%96%E5%86%99%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95/">阅读全文<span class="seo-reader-text">【Rust 学习记录】11. 编写自动化测试</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2023/05/08/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9110-%E6%B3%9B%E5%9E%8B%E3%80%81trait%E4%B8%8E%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/">【Rust 学习记录】10. 泛型、trait与生命周期</a></h3><div class="home-article-content markdown-body">泛型泛型是一种具体类型或者其他属性的抽象替代,通常用来减少代码的重复,接下来将从泛型的几个实际应用场景开始介绍泛型 应用场景在函数定义中使用现在假设我们要写一个寻找数组最大值的功能,我要怎么实现既能从字符数组里查找最大值,又能从整数数组里查找最大值?定义两个函数分别查找的话难免重复性有点高,这时候就需要使用泛型。 123456789fn largest<T>(list: &...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Mon May 08 2023 21:17:12 GMT+0800">2023-05-08 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2023/05/08/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%9110-%E6%B3%9B%E5%9E%8B%E3%80%81trait%E4%B8%8E%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/">阅读全文<span class="seo-reader-text">【Rust 学习记录】10. 泛型、trait与生命周期</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2023/04/15/%E4%BD%BF%E7%94%A8Sphinx%E4%B8%BA%E4%BD%A0%E7%9A%84%E9%A1%B9%E7%9B%AE%E5%BF%AB%E9%80%9F%E6%9E%84%E5%BB%BA%E6%96%87%E6%A1%A3/">使用Sphinx为你的项目快速构建文档</a></h3><div class="home-article-content markdown-body">最近写了个软件,需要写个接口文档,看到别人项目的文档有不少都是托管在 Read the Docs 上的,于是搜了一下,Read the Docs 是一个托管平台,而这个平台的文档是基于 Sphinx 构建的,所以就学了一下,以此记录。 安装Sphinx很简单,用pip安装即可,尽量使用官方的源,国内源听说多少有点问题 1pip install sphinx 构建Sphinx项目快速构建推荐...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Sat Apr 15 2023 01:13:00 GMT+0800">2023-04-15 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E5%A5%BD%E8%BD%AF%E6%8E%A8%E8%8D%90/">好软推荐</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/%E5%A5%BD%E8%BD%AF%E6%8E%A8%E8%8D%90/">好软推荐</a> </li></ul></span></div><a href="/2023/04/15/%E4%BD%BF%E7%94%A8Sphinx%E4%B8%BA%E4%BD%A0%E7%9A%84%E9%A1%B9%E7%9B%AE%E5%BF%AB%E9%80%9F%E6%9E%84%E5%BB%BA%E6%96%87%E6%A1%A3/">阅读全文<span class="seo-reader-text">使用Sphinx为你的项目快速构建文档</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2023/04/06/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%919-%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/">【Rust 学习记录】9. 错误处理</a></h3><div class="home-article-content markdown-body">前言 Rust 里的错误主要分为两种:1. 不可恢复错误:主要指的就是程序Bug之类的用户不可见的错误,例如尝试访问超过数组长度的下标;2. 可恢复错误,例如文件没找到等,可以提示用户再次查找。Rust 对这两种错误进行了区分,并针对不同的场景提供了许多的特性来处理 不可恢复错误与Panic!Panic!宏介...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Thu Apr 06 2023 22:23:58 GMT+0800">2023-04-06 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2023/04/06/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%919-%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86/">阅读全文<span class="seo-reader-text">【Rust 学习记录】9. 错误处理</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li><li class="home-article-item"><div class="flex flex-col gap-5 px-7 pb-7 pt-7"><h3 class="home-article-title"><a href="/2023/04/02/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%918-%E9%80%9A%E7%94%A8%E9%9B%86%E5%90%88%E7%B1%BB%E5%9E%8B/">【Rust 学习记录】8. 通用集合类型</a></h3><div class="home-article-content markdown-body">动态数组定义1let a:Vec<i32> = Vec::new(); 定义非常简单,是Vec的格式,Vec 也就是 vector,动态数组类型的关键字,用两个尖括号括住动态数组所存放的数据类型 T,代码里就是存放 i32 类型的数据。再使用new方法分配一片空间。 上面是一个创建一个指定类型的空数组,因为是空数组,所以编译器没法推理出我们数组的类型,所以要显示定义类型,如果给...</div><div class="home-article-meta-info-container"><div class="home-article-meta-info"><span><i class="fa-solid fa-calendars"></i> <span class="home-article-date" data-date="Sun Apr 02 2023 22:51:57 GMT+0800">2023-04-02 </span></span><span class="home-article-category"><i class="fa-solid fa-folders"></i> <ul><li><a href="/categories/%E7%BC%96%E7%A8%8B-%E8%AF%AD%E8%A8%80/">编程/语言</a> </li></ul></span><span class="home-article-tag"><i class="fa-solid fa-tags"></i> <ul><li><a href="/tags/Rust/">Rust</a> </li></ul></span></div><a href="/2023/04/02/%E3%80%90Rust-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95%E3%80%918-%E9%80%9A%E7%94%A8%E9%9B%86%E5%90%88%E7%B1%BB%E5%9E%8B/">阅读全文<span class="seo-reader-text">【Rust 学习记录】8. 通用集合类型</span> <i class="fa-solid fa-angle-right"></i></a></div></div></li></ul><div class="home-paginator px-7 py-5"><div class="paginator"><span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="extend next" rel="next" href="/page/2/"><i class="fa-regular fa-angle-right"></i></a></div></div></div></div></div><div class="main-content-footer"><footer class="footer mt-5 py-5 h-auto text-base text-third-text-color relative border-t-2 border-t-border-color"><div class="info-container py-3 text-center"><div class="text-center">© <span>2022</span> - 2024 <i class="fa-regular fa-computer-classic"></i> <a href="/">TwoSix</a><p class="post-count space-x-0.5"><span>共撰写了 17 篇文章 </span><span>共 55.8k 字</span></p></div><script data-swup-reload-script src="https://cn.vercount.one/js"></script><div class="relative text-center lg:absolute lg:right-[20px] lg:top-1/2 lg:-translate-y-1/2 lg:text-right"><span id="busuanzi_container_site_uv" class="lg:!block"><span class="text-sm">访问人数</span> <span id="busuanzi_value_site_uv"></span> </span><span id="busuanzi_container_site_pv" class="lg:!block"><span class="text-sm">总访问量</span> <span id="busuanzi_value_site_pv"></span></span></div><div class="relative text-center lg:absolute lg:left-[20px] lg:top-1/2 lg:-translate-y-1/2 lg:text-left"><span class="lg:block text-sm">由 <?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="relative top-[2px] inline-block align-baseline" version="1.1" id="圖層_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1rem" height="1rem" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><path fill="#0E83CD" d="M256.4,25.8l-200,115.5L56,371.5l199.6,114.7l200-115.5l0.4-230.2L256.4,25.8z M349,354.6l-18.4,10.7l-18.6-11V275H200v79.6l-18.4,10.7l-18.6-11v-197l18.5-10.6l18.5,10.8V237h112v-79.6l18.5-10.6l18.5,10.8V354.6z"/></svg><a target="_blank" class="text-base" href="https://hexo.io">Hexo</a> 驱动</span> <span class="text-sm lg:block">主题 <a class="text-base" target="_blank" href="https://github.com/EvanNotFound/hexo-theme-redefine">Redefine v2.8.2</a></span></div><div class="icp-info my-1"><a target="_blank" rel="nofollow" href="https://icp.gov.moe/">萌ICP备20232266号</a></div><div>博客已运行 <span class="odometer" id="runtime_days"></span> 天 <span class="odometer" id="runtime_hours"></span> 小时 <span class="odometer" id="runtime_minutes"></span> 分钟 <span class="odometer" id="runtime_seconds"></span> 秒</div><script data-swup-reload-script>try{function odometer_init(){document.querySelectorAll(".odometer").forEach(e=>{new Odometer({el:e,format:"( ddd).dd",duration:200})})}odometer_init()}catch(e){}</script><a style="text-decoration:none;display:inline-flex;align-items:center;justify-content:center" href="https://travel.moe/go.html" title="异次元之旅-跃迁-我们一起去萌站成员的星球旅行吧!" target="_blank"><img src="https://travel.moe/images/icon/icon64.png" style="width:24px;height:24px;margin-right:8px">异次元之旅</a></div></footer></div></div><div class="right-side-tools-container"><div class="side-tools-container"><ul class="hidden-tools-list"><li class="right-bottom-tools tool-font-adjust-plus flex justify-center items-center"><i class="fa-regular fa-magnifying-glass-plus"></i></li><li class="right-bottom-tools tool-font-adjust-minus flex justify-center items-center"><i class="fa-regular fa-magnifying-glass-minus"></i></li><li class="right-bottom-tools tool-dark-light-toggle flex justify-center items-center"><i class="fa-regular fa-moon"></i></li><li class="right-bottom-tools tool-scroll-to-bottom flex justify-center items-center"><i class="fa-regular fa-arrow-down"></i></li></ul><ul class="visible-tools-list"><li class="right-bottom-tools toggle-tools-list flex justify-center items-center"><i class="fa-regular fa-cog fa-spin"></i></li><li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center"><i class="arrow-up fas fa-arrow-up"></i> <span class="percent"></span></li></ul></div></div><div class="image-viewer-container"><img src=""></div><div class="search-pop-overlay"><div class="popup search-popup"><div class="search-header"><span class="search-input-field-pre"><i class="fa-solid fa-keyboard"></i></span><div class="search-input-container"><input autocomplete="off" autocorrect="off" autocapitalize="off" placeholder="站内搜索您需要的内容..." spellcheck="false" type="search" class="search-input"></div><span class="popup-btn-close"><i class="fa-solid fa-times"></i></span></div><div id="search-result"><div id="no-result"><i class="fa-solid fa-spinner fa-spin-pulse fa-5x fa-fw"></i></div></div></div></div></main><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/Swup.min.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/SwupSlideTheme.min.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/SwupScriptsPlugin.min.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/SwupProgressPlugin.min.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/SwupScrollPlugin.min.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/SwupPreloadPlugin.min.js"></script><script>const swup=new Swup({plugins:[new SwupScriptsPlugin({optin:!0}),new SwupProgressPlugin,new SwupScrollPlugin({offset:80}),new SwupSlideTheme({mainElement:".main-content-body"}),new SwupPreloadPlugin],containers:["#swup"]})</script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/imageViewer.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/utils.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/main.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/layouts/navbarShrink.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/scrollTopBottom.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/lightDarkSwitch.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/layouts/categoryList.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/localSearch.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/codeBlock.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/layouts/lazyload.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/runtime.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/odometer.min.js"></script><link rel="stylesheet" href="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/assets/odometer-theme-minimal.css"><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/Typed.min.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/plugins/typed.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/anime.min.js"></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/tools/tocToggle.js" data-swup-reload-script></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/layouts/toc.js" data-swup-reload-script></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/plugins/tabs.js" data-swup-reload-script></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/moment-with-locales.min.js" data-swup-reload-script></script><script type="module" src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/layouts/essays.js" data-swup-reload-script></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/libs/pangu.min.js"></script><script src="https://registry.npmmirror.com/hexo-theme-redefine/2.8.2/files/source/js/build/plugins/pangu.js"></script></body></html>