<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[gopher9511的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/gopher9511</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; gopher9511]]></copyright><item><title><![CDATA[RUST：序列化与反序列化 toml 详解]]></title><link>https://blog.csdn.net/gopher9511/article/details/168331215</link><guid>https://blog.csdn.net/gopher9511/article/details/168331215</guid><author>gopher9511</author><pubDate>Sun, 18 Oct 2026 10:52:12 +0800</pubDate><description><![CDATA[TOML 常用于程序配置，因为键、表、数组和注释对人比较友好。它仍然是一种严格格式：没有 null，整数有范围，日期时间有自己的类型，重复键和混合错误会导致解析失败。把文件成功读成结构体，只完成了配置加载的一部分；端口、并发数、目录和权限还要在应用启动前检查。本文使用 Rust 1.94.0、edition 2024、和。]]></description><category></category></item><item><title><![CDATA[RUST：序列化与反序列化 serde + derive 详解]]></title><link>https://blog.csdn.net/gopher9511/article/details/168331152</link><guid>https://blog.csdn.net/gopher9511/article/details/168331152</guid><author>gopher9511</author><pubDate>Sun, 18 Oct 2026 10:50:40 +0800</pubDate><description><![CDATA[普通字段优先使用 derive。线格式和领域类型确实不一致时，再用with或。适配器应先读一个明确的中间类型，再做格式与范围检查，错误通过返回。//!本例用字段适配器为 TaskId 定义稳定线格式，并用 Visitor 兼容两种旧输入。//!错误前缀、零 ID 和非数字文本都是故意失败路径。wherewhere;.ok_or_else(|| de::Error::custom("任务 ID 必须以 task- 开头"))?;]]></description><category></category></item><item><title><![CDATA[RUST：错误处理 thiserror + anyhow 工程化详解]]></title><link>https://blog.csdn.net/gopher9511/article/details/168027756</link><guid>https://blog.csdn.net/gopher9511/article/details/168027756</guid><author>gopher9511</author><pubDate>Thu, 15 Oct 2026 18:07:53 +0800</pubDate><description><![CDATA[[error("无法读取插件清单 {path:?}")]Read {#[source]},#[error("插件清单 {path:?} 不是符合要求的 JSON")]Decode {#[source]},#[error("插件清单 {path:?} 的 id {id:?} 非法：只能包含 ASCII 小写字母、数字和连字符")]#[error("插件清单 {path:?} 的入口路径 {entry:?} 不安全：{reason}")]},中的Error来自thiserror。]]></description><category></category></item><item><title><![CDATA[RUST：错误处理 thiserror 详解]]></title><link>https://blog.csdn.net/gopher9511/article/details/168027745</link><guid>https://blog.csdn.net/gopher9511/article/details/168027745</guid><author>gopher9511</author><pubDate>Thu, 15 Oct 2026 18:07:17 +0800</pubDate><description><![CDATA[thiserror的作用可以概括为一句话：用声明式写法生成标准 Rust 错误实现。生成实现；定义当前层的Display；#[from]生成直接错误转换，并隐含#[source]；#[source]保留底层原因；在没有新错误语义时透明转发。真正决定代码质量的，仍然是错误类型本身：变体是否反映业务事实，上下文是否在正确层补充，source 是否完整，显示文本是否重复，公开 API 是否承担了明确而稳定的承诺。宏替开发者省下样板代码，省下来的注意力应该用在这些问题上。]]></description><category></category></item><item><title><![CDATA[RUST：错误处理 anyhow 详解]]></title><link>https://blog.csdn.net/gopher9511/article/details/168027728</link><guid>https://blog.csdn.net/gopher9511/article/details/168027728</guid><author>gopher9511</author><pubDate>Thu, 15 Oct 2026 18:06:28 +0800</pubDate><description><![CDATA[anyhow的价值不只是少写一个错误枚举。它把应用层错误处理集中到三件事上：让不同错误通过?正常汇总，在抽象边界补充有用上下文，在程序边界完整地报告因果链。真正需要掌握的不是几个宏的拼写，而是边界选择：哪些失败只需要报告，哪些失败必须成为稳定类型；哪一层知道路径、行号和操作名称；哪一层负责日志、退出码和对外文案。是应用层的统一返回类型，不是新的异常机制；?仍然是显式错误返回，只是顺便完成类型转换；用context和增加事实，不要复制底层消息；用anyhow!构造错误，用bail!提前返回，用。]]></description><category></category></item><item><title><![CDATA[Cloudflare 2025 年 11 月 18 日故障报告]]></title><link>https://blog.csdn.net/gopher9511/article/details/155039648</link><guid>https://blog.csdn.net/gopher9511/article/details/155039648</guid><author>gopher9511</author><pubDate>Wed, 19 Nov 2025 22:46:30 +0800</pubDate><description><![CDATA[2025年11月18日，Cloudflare发生全球性网络故障，导致用户访问客户网站时出现HTTP 5xx错误。故障源于数据库权限变更，使机器人管理系统使用的特征文件重复条目激增，文件体积超出软件限制。]]></description><category></category></item><item><title><![CDATA[Go 语言的 channel]]></title><link>https://blog.csdn.net/gopher9511/article/details/152490622</link><guid>https://blog.csdn.net/gopher9511/article/details/152490622</guid><author>gopher9511</author><pubDate>Sat, 04 Oct 2025 13:30:00 +0800</pubDate><description><![CDATA[它可以同时等待多个 channel 的事件发生，并在其中一个 channel 可用时执行相应的操作。Go 使用 make 函数来创建 channel，并通过指定类型来确定 channel 传递的数据类型。有缓冲的 channel 可以存储一定数量的数据，当缓冲区满时，发送操作将被阻塞，直到有数据被接收。类型安全：channel 的类型在定义时是固定的，一个 channel 只能传输一种类型的数据。通知接收方没有更多的数据会被发送。无缓冲（默认）和 有缓冲：channel 可以是无缓冲的（默认）或有缓冲的。]]></description><category></category></item><item><title><![CDATA[Go 语言的 panic 和 recover]]></title><link>https://blog.csdn.net/gopher9511/article/details/152490580</link><guid>https://blog.csdn.net/gopher9511/article/details/152490580</guid><author>gopher9511</author><pubDate>Sat, 04 Oct 2025 12:15:00 +0800</pubDate><description><![CDATA[Go语言通过panic和recover处理异常：panic用于触发不可恢复错误，终止当前函数执行；recover则需在defer中调用，用于捕获panic并恢复程序执行。实际应用中，panic适用于严重错误（如数组越界），recover通常用于Web中间件或数据库事务等场景。开发者应避免滥用，优先使用显式错误处理，因为它们不适合高频代码或并发错误处理。典型的Web服务器案例展示了如何用recover捕获panic并返回500错误，防止程序崩溃。]]></description><category></category></item><item><title><![CDATA[go中的Ticker]]></title><link>https://blog.csdn.net/gopher9511/article/details/152490515</link><guid>https://blog.csdn.net/gopher9511/article/details/152490515</guid><author>gopher9511</author><pubDate>Sat, 04 Oct 2025 11:00:00 +0800</pubDate><description><![CDATA[Go语言中的time.Ticker提供了一种高效的周期性任务执行机制。它通过内部协程定期向通道发送时间信号实现定时触发，包含三个核心组件：定时通道C、停止通道Stop和时间间隔period。典型用法是通过select语句监听Ticker.C通道，实现周期性任务执行。开发者可以结合context包实现任务超时或手动取消，通过监听ctx.Done()来优雅终止定时任务。这种基于协程和通道的设计既保证了线程安全，又提供了灵活的定时控制能力，非常适合需要周期性执行的场景。]]></description><category></category></item><item><title><![CDATA[Go语言中的map]]></title><link>https://blog.csdn.net/gopher9511/article/details/152460048</link><guid>https://blog.csdn.net/gopher9511/article/details/152460048</guid><author>gopher9511</author><pubDate>Fri, 03 Oct 2025 18:22:58 +0800</pubDate><description><![CDATA[Go语言中的map是一种无序的键值对数据结构，适合实现哈希表、字典等功能。map通过make()或字面量创建，键必须是可比较类型（如字符串、数字等），而值可以是任意类型。基本操作包括插入、更新、删除元素，以及通过range遍历（顺序随机）。map是引用类型，自动扩容，查找效率高（O(1)）。常见应用场景包括去重、频率统计和缓存。需注意未初始化的nil map会引发运行时错误，而空map需通过make()创建。]]></description><category></category></item><item><title><![CDATA[Go中的字符串]]></title><link>https://blog.csdn.net/gopher9511/article/details/152458273</link><guid>https://blog.csdn.net/gopher9511/article/details/152458273</guid><author>gopher9511</author><pubDate>Fri, 03 Oct 2025 17:31:35 +0800</pubDate><description><![CDATA[Go字符串处理摘要 Go字符串支持UTF-8编码，具有不可变性。关键特性包括： 使用双引号定义普通字符串，反引号定义原始多行字符串 字符串长度按字节计算，处理字符需转rune类型 提供多种高效操作：字符串拼接推荐strings.Builder；支持切片、比较、查找、替换、分割等操作 类型转换：可转为[]byte或[]rune处理 实用函数：大小写转换、修剪空白等 注意字符串拼接性能，避免频繁内存分配]]></description><category></category></item><item><title><![CDATA[go中的切片]]></title><link>https://blog.csdn.net/gopher9511/article/details/152418466</link><guid>https://blog.csdn.net/gopher9511/article/details/152418466</guid><author>gopher9511</author><pubDate>Thu, 02 Oct 2025 21:58:44 +0800</pubDate><description><![CDATA[本文介绍了Go语言中数组和切片的核心概念与区别。数组是固定长度的值类型集合，长度在编译时确定，内存连续。切片是动态视图，可变化长度和容量，属于引用类型。切片通过底层数组实现，支持append、copy等操作，但需要注意共享底层数组可能导致的数据修改问题。文章详细讲解了切片的扩容机制（容量1024以下两倍扩容）、零值与空切片的区别、浅拷贝特性，以及在循环中使用append可能导致的性能问题。通过示例代码展示了数组和切片的基本操作及常见陷阱，如切片操作不复制底层数组、append可能触发重分配等情况。]]></description><category></category></item><item><title><![CDATA[lua 元表]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579903</link><guid>https://blog.csdn.net/gopher9511/article/details/143579903</guid><author>gopher9511</author><pubDate>Tue, 17 Dec 2024 12:23:37 +0800</pubDate><description><![CDATA[在 Lua 中，元表（Metatable）是一种强大的机制，它允许程序员自定义表（table）的行为。通过使用元表，你可以改变表的运算符重载、方法调用、索引方式等行为。元表能够让 Lua 的表更具灵活性和功能性。]]></description><category></category></item><item><title><![CDATA[lua 函数]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579761</link><guid>https://blog.csdn.net/gopher9511/article/details/143579761</guid><author>gopher9511</author><pubDate>Tue, 12 Nov 2024 20:02:59 +0800</pubDate><description><![CDATA[使用 function 关键字来定义一个函数。-- 函数体return value -- 可选，返回值endendprint(add(2, 3)) -- 输出: 5Lua 允许函数接收可变数量的参数，可以使用 … 来表示。endprint(concatenate("apple", "banana", "cherry")) -- 输出: apple, banana, cherry一个闭包是在其外部函数的作用域中定义的函数，它可以捕获和访问该作用域中的变量。]]></description><category></category></item><item><title><![CDATA[lua 中引用]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579742</link><guid>https://blog.csdn.net/gopher9511/article/details/143579742</guid><author>gopher9511</author><pubDate>Mon, 11 Nov 2024 08:16:47 +0800</pubDate><description><![CDATA[在 Lua 中，引用（或引用类型）涉及到如何处理表（Arrays，Tables）和其他复杂数据结构。与基本数据类型（如数字、字符串和布尔值）不同，表是引用类型，这意味着它们在内存中的处理方式与基本数据类型有所不同。我们用到的所有的 table 都是匿名的，所有的变量，只是对其引用而己。我们对于 table的操作仅仅是对其引用的操作。对于 Table 的引用，类似于 C++中 shared_ptr 对于对象的托管一样，采用了引用计数的方式。]]></description><category></category></item><item><title><![CDATA[lua 数组]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579732</link><guid>https://blog.csdn.net/gopher9511/article/details/143579732</guid><author>gopher9511</author><pubDate>Mon, 11 Nov 2024 08:16:25 +0800</pubDate><description><![CDATA[table 是 Lua 中唯一的数据结构，其他语言所提供的数据结构，如：arrays、records、lists、 queues、 sets 等，Lua 都是通过 table 来实现在 lua 中通过整数下标访问 table 中元素，即是数组。并且数组大小不固定，可动态增长。数组是有序的对象的装置，它可以是包含含有多个行和列的行或多维阵列的集合的单个二维数组。]]></description><category></category></item><item><title><![CDATA[lua 字符串]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579705</link><guid>https://blog.csdn.net/gopher9511/article/details/143579705</guid><author>gopher9511</author><pubDate>Sat, 09 Nov 2024 17:30:32 +0800</pubDate><description><![CDATA[Lua 提供了字符串处理函数，可以方便地处理字符串。使用一对匹配的单引号.例：‘hello’.使用一对匹配的双引号.例：“abclua”.字符串还可以用一种长括号(即[[ ]]) 括起来的方式定义.]]></description><category></category></item><item><title><![CDATA[lua ruturn 和goto]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579686</link><guid>https://blog.csdn.net/gopher9511/article/details/143579686</guid><author>gopher9511</author><pubDate>Sat, 09 Nov 2024 17:30:11 +0800</pubDate><description><![CDATA[goto 语句，可以跳到程序中的任意 Label 标号，其 Label 的书写方式 ::name::。lua 虽然没有提供 continue 逻辑，contiune 的逻辑本质就是过滤，可以能过合理的安。return 只能出现在，语句块的结尾，或是 end，else 和 until 的前面。标号处的语句是依次执行的。不要理解为 Label 后的语句是函数，等待被调用。function 语句用于定义函数，可以指定函数名、参数、返回值、函数体。goto 语句不能跨越函数，也不能跳入局部变量的作用域。]]></description><category></category></item><item><title><![CDATA[lua 运算符和控制语句]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579653</link><guid>https://blog.csdn.net/gopher9511/article/details/143579653</guid><author>gopher9511</author><pubDate>Wed, 06 Nov 2024 20:50:31 +0800</pubDate><description><![CDATA[=~=>=<=andornot..a and b 当 a 为真时返回 b， 当 a 为假时，返回 a 条件表达式 a?b:aa or b 当 a 为真时返回 a， 当 a 为假时，返回 b 条件表达式 a?a:bnot a 当 a 为真时返回假，当 a 为假时，返回真 条件表达式 a?false:true。]]></description><category></category></item><item><title><![CDATA[Lua数据类型]]></title><link>https://blog.csdn.net/gopher9511/article/details/143579638</link><guid>https://blog.csdn.net/gopher9511/article/details/143579638</guid><author>gopher9511</author><pubDate>Wed, 06 Nov 2024 20:49:41 +0800</pubDate><description><![CDATA[Table 类型中一种基于 k-v 类型，实现了一种抽象的 “map”。索引 k 通常是字符串(string) 或者 number 类型，但也可以是除 nil 以外的任意类型。并不展开(此举，跟 C++11 中 R"(hello lua)"相似) , 2 -> 便于多行书写。对于无 key 的类型，此时的 key 类型为 number，下标从 1 开始，下标依次累加。字符串还可以用一种长括号(即[[ ]]) 括起来的方式定义。Lua 中没有字符类型，所谓的字符类型也是含有一个字符的字符串而己。]]></description><category></category></item></channel></rss>