Rust 程序设计语言 简体中文版 1.85.0
match 表达式和 if let 控 制流结构。在 Rust 中,创建自定义类型需要用到结构体和枚举。 第七章介绍 Rust 的模块(module)系统,其中的私有性规则用来组织代码和公开的 API(应 用程序接口)。第八章讨论标准库提供的常见集合数据结构,例如 Vector(向量)、字符串和 Hash Map(散列表)。第九章探索 Rust 的错误处理的理念与技术。 第十章深入介绍泛型(generic)、Trait rustup doc 在浏览器中查看本地 文档。 任何时候,如果你拿不准标准库中的类型或函数的用途和用法,请查阅应用程序接口 (application programming interface,API)文档! 文本编辑器和集成开发环境(Integrated Development Environments, IDE) 本书不会假设你使用何种工具来编写 Rust 代码。几乎任何文本编辑器都可以搞定!然而,很 程序 接下来,新建一个源文件,命名为 main.rs。Rust 源文件总是以 .rs 扩展名结尾。如果文件名 包含多个单词,那么按照命名习惯,应当使用下划线来分隔单词。例如命名为 hello_world.rs, 而不是 helloworld.rs。 现在打开刚创建的 main.rs 文件,输入示例 1-1 中的代码。 文件名:main.rs fn main() { println!("Hello0 码力 | 562 页 | 3.23 MB | 9 天前3Tornado 6.5 Documentation
Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s coroutine, and then stop the IOLoop with the IOLoop.run_sync method. This is often used to start the main function of a batch-oriented program: # run_sync() doesn't take arguments, so we must wrap the # no work left in the queue. Thus that worker’s call to task_done decrements the counter to zero. The main coroutine, which is waiting for join, is unpaused and finishes. #!/usr/bin/env python3 import asyncio0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait()if __name__ == "__main__": asyncio.run(main()) This example does not use any http1connection – HTTP/1.x client/server implementation Asynchronous networking tornado.ioloop — Main event loop tornado.iostream — Convenient wrappers for non-blocking socketstornado.netutil — Miscellaneous the background Queue example - a concurrent web spider Structure of a Tornado web application The main coroutine The Application object Subclassing RequestHandler Handling request input Overriding RequestHandler0 码力 | 437 页 | 405.14 KB | 2 月前3
共 3 条
- 1