Rust 程序设计语言 简体中文版 1.85.0
`hosting` | help: consider importing this module through its public re-export | 10 + use crate::hosting; | warning: unused import: `crate::front_of_house::hosting` --> src/lib.rs:7:5 | 7 | use 而不是 use my_crate::UsefulType; 来使用类型。 好消息是,即使文件结构对于用户来说不是很方便,你也无需重新安排内部组织:你可以选择 使用 pub use 重导出(re-export)项来使公有结构不同于私有结构。重导出获取位于一个位 置的公有项并将其公开到另一个位置,好像它就定义在这个新位置一样。 例如,假设我们创建了一个描述艺术概念的库 art。这个库中包含了一个有两个枚举 Compiling rand v0.8.5 Compiling add_one v0.1.0 (file:///projects/add/add_one) warning: unused import: `rand` --> add_one/src/lib.rs:1:5 | 1 | use rand; | ^^^^ | = note: `#[warn(unused_imports)]`0 码力 | 562 页 | 3.23 MB | 10 天前3Tornado 6.5 Documentation
linksCHAPTER TWO HELLO, WORLD Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client.fetch(url) here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient import AsyncHTTPClient async def asynchronous_fetch(url): http_client = AsyncHTTPClient() response = await0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
wiki/Links] Hello, world Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self await or yield keywords. Examples Here is a sample synchronous function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client here is the same function rewritten asynchronously as a native coroutine: from tornado.httpclient import AsyncHTTPClient async def asynchronous_fetch(url): http_client = AsyncHTTPClient() response0 码力 | 437 页 | 405.14 KB | 2 月前3
共 3 条
- 1