Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何迭代每隔一个数字
阅读文档时 我注意到一句话 Rust 没有C stylefor 循环 所以 我想知道 如何制作一个相当于for i 0 i lt 10 i 2 我能想到的方法是这样的 for i in 0 10 if i 2 0 Do stuff Or e
loops
Rust
什么时候适合使用关联类型而不是泛型类型?
In 这个问题 https stackoverflow com q 32053402 155423 出现了一个问题 可以通过将使用泛型类型参数的尝试更改为关联类型来解决 这引发了一个问题 为什么关联类型在这里更合适 这让我想了解更多 The
types
Rust
idioms
如何惯用地复制切片?
在 Go 中 复制切片是标准操作 如下所示 It will figure out the details to match slice sizes dst copy dst n src m 在 Rust 中 我找不到类似的替换方法 我想出的
Rust
slice
如何让 Cargo 显示哪些文件导致重建?
我在用cargo maturin and pytest构建混合 Python Rust 项目 在开发过程中 我经常循环使用命令 cargo test p mypkg release maturin develop release pytho
Rust
rustcargo
pyo3
为什么在 Rust 中无法在不引用其中之一的情况下连接两个字符串?
这有效 let hello Hello to string let world world let hello world hello world 但这并没有 let hello Hello to string let world worl
Rust
在 FFI 中使用 ptr::NonNull 是否有效?
铁锈具有ptr NonNull https doc rust lang org beta std ptr struct NonNull html代表非的类型NULL指针 在 FFI 中使用这种类型安全吗 是否保证具有相同的二进制表示形式 忽
Rust
FFI
ABI
nonnullable
“流不包含有效的 UTF-8”是什么意思?
我正在创建一个简单的 HTTP 服务器 我需要读取请求的图像并将其发送到浏览器 我正在使用这段代码 fn read file mut file name String gt String file name file name replac
UTF8
Stream
Rust
我可以在运行时选择一个特征对象而不使用 Box
吗?
我想分支并决定在运行时在函数中使用的 Trait 实现 请参阅poly read在下面的代码示例中 Trait 对象是在 if 表达式的分支臂内部构造的 并且只需要在 if 表达式的生命周期内存在poly read但我需要Box它是因为无法
Rust
lifetime
相同代码的货物构建:虚假的编译时错误?
我有板条箱A取决于B and B取决于rust nmea https github com Dushistov rust nmea crate 如果我建造箱子A我遇到了很多错误 所有错误都错过了 use std error Error 在构
Rust
rustcargo
rustcrates
如何使用(不安全)别名?
Rust 有严格的别名规则 但如果 我知道自己在做什么 我可以解决这些问题吗 我试图将一个 C 函数转换为 Rust 该函数通过从输入缓冲区读取并写入目标缓冲区来执行复杂的操作 但它有一个巧妙的优化 允许输入和输出缓冲区相同 foo src
Rust
strictaliasing
borrowchecker
尝试将盒装 dyn 特征传递到函数时出现“借用的值寿命不够长”错误
我是 Rust 新手 我对借用检查器的行为感到非常困惑 trait Foo fn foo self struct Bar lt a gt pub f a Vec
Rust
Iterator::collect 分配的内存量是否与 String::with_capacity 相同?
在 C 中 当连接一堆字符串时 其中每个元素的大小大致已知 通常会预先分配内存以避免多次重新分配和移动 std vector
Rust
dynamicmemoryallocation
是否有一种简洁的方法可以使用现有数据的副本生成新线程?
我正在尝试生成几个新线程 其中每个线程都有自己的copy某个州的 我想要的是这样的 use std thread fn main let data vec 42 10 let more data Important data to stri
Rust
如何使用release编译一些依赖项
我想使用 dev 配置文件构建我的 Rust 应用程序 但使用 release 配置文件构建一些依赖项 因为否则它们真的很慢 如何有选择地为我的板条箱依赖项指定配置文件 Cargo 能够覆盖特定包裹的配置文件 来自参考 https doc
Rust
rustcargo
允许 Rust 格式中未使用的命名参数!() 系列
Given format red reset text red RED blue BLUE reset RESET 编译器退出并出现错误 error named argument never used gt example rs 1 47
Rust
如何使用 Box
> 的地图?
我有一段代码如下 fn stream it self gt Box
Rust
asyncawait
当计数为 1 时,有条件地将 T 从 Rc
移出
有没有办法将物体从Rc
Rust
referencecounting
ownershipsemantics
使用推断的 (?) 类型克隆 std::iter::Map
我在以紧凑的方式克隆地图时遇到问题 extern crate itertools num use itertools num linspace fn main 440Hz as wave frequency middle A let fre
Iterator
Rust
clone
typeinference
幻影数据用例
我试图理解 rust 中的 phantomData 我有一个 Foo 结构包裹着一个原始指针 我告诉编译器 Foo 不能比 a 更长寿 所以我试图防止属性 v 的值在 Foo 之前被删除 但是我发现当 String s 可以在 f 之前删除
Rust
如何使用 Warp 检查授权标头?
我正在使用 Rust 和 Warp 构建 graphql api 我已经浏览了文档 但我仍然不知道如何链接过滤器 特别是检查authorization在请求头中 let context extractor warp any this cod
Rust
rustwarp
«
1 ...
4
5
6
7
8
9
10
...94
»