rust

    30热度

    2回答

    我正在寻找一个Rust服务器的例子。 “hello world”或echo服务器会很好。

    39热度

    1回答

    有时候我发现自己想要编写能够在任一被称为两种方式功能: // With a string literal: let lines = read_file_lines("data.txt"); // With a string pointer: let file_name = ~"data.txt"; let lines = read_file_lines(file_name); 我的第

    4热度

    2回答

    我有时会发现自己写抽象类与部分实现在C#: abstract public class Executor { abstract protected bool Before(); abstract protected bool During(); abstract protected bool After(); protected bool Execute()

    4热度

    1回答

    我知道可变字段在0.6中被删除。我收到以下错误代码, C:\Users\mflamer\Dropbox\Rust\Tests\gmap.rs:23:8: 23:18 error: assigning to immutable field C:\Users\mflamer\Dropbox\Rust\Tests\gmap.rs:23 dart.alpha = vec::from_elem(self.n

    2热度

    1回答

    我创建了以下防锈结构: struct HTTPRequestHeader { name: ~str, data: ~str, next: Option<~HTTPRequestHeader> } 以下代码打印出来: fn print_headers(hdr: &HTTPRequestHeader) { println(fmt!("%s: %s", (*

    4热度

    1回答

    在铁锈社区的慷慨帮助下,我设法使用托管指针组装了拓扑数据结构的基础。这很好地融合在一起,我对Rust的整体感到非常兴奋。然后我读了这个post(这看起来像是一个合理的计划),它激励我回溯并尽可能地仅使用拥有的指针重新组装它。 这是使用管理指针的工作版本: struct Dart<T> { alpha: ~[@mut Dart<T>], embed: ~[@mut T],

    21热度

    1回答

    这是一个非常简单的例子,但我会怎么做类似的东西: let fact = |x: u32| { match x { 0 => 1, _ => x * fact(x - 1), } }; 我知道这个具体的例子可以用迭代很容易做到,但我不知道是否有可能作出递归在Rust中用于更复杂的事情(比如遍历树)或者我需要使用自己的堆栈。

    18热度

    3回答

    Rust中的组合运营商和管道转发运营商(like in other languages)是否都存在?如果是这样,他们是什么样子,一个人应该比另一个更喜欢?如果不存在,为什么这个操作员不需要?

    17热度

    1回答

    我在摆弄Rust,试着做例子,试着做一个课。我一直在寻找的example of StatusLineText 它不断提高的错误: error: `self` is not available in a static method. Maybe a `self` argument is missing? [E0424] self.id + self.extra ^~~~

    5热度

    1回答

    我想弄清楚如何在Rust中编译多文件板条箱,但我不断收到编译错误。 我有一个文件我想导入到箱子thing.rs: mod asdf { pub enum stuff { One, Two, Three } } 我的箱子文件test.rc: mod thing; use thing::asdf::*; fn main(){ }