Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 31 - 40 of 2,415 for Rust (0.02 seconds)

  1. fastapi/_compat/v2.py

            # What calls this code passes a value that already called
            # self._type_adapter.validate_python(value)
            # This uses Pydantic's dump_json() which serializes directly to JSON
            # bytes in one pass (via Rust), avoiding the intermediate Python dict
            # step of dump_python(mode="json") + json.dumps().
            return self._type_adapter.dump_json(
                value,
                include=include,
                exclude=exclude,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 16.7K bytes
    - Click Count (0)
  2. docs/zh-hant/docs/advanced/custom-response.md

    如果你追求效能,使用[回應模型](../tutorial/response-model.md) 大概會比使用 `orjson` 回應更好。
    
    有了回應模型,FastAPI 會使用 Pydantic 直接將資料序列化為 JSON,而不需要像其他情況那樣先經過 `jsonable_encoder` 之類的中介步驟。
    
    而且在底層,Pydantic 用來序列化為 JSON 的 Rust 機制和 `orjson` 相同,因此用回應模型已經能獲得最佳效能。
    
    ## 預設回應類別 { #default-response-class }
    
    在建立 **FastAPI** 類別實例或 `APIRouter` 時,你可以指定預設要使用哪個回應類別。
    
    用來設定的是 `default_response_class` 參數。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 10.3K bytes
    - Click Count (0)
  3. docs/zh-hant/docs/tutorial/response-model.md

    * 在 OpenAPI 的「路徑操作」中為回應新增 JSON Schema。
        * 這會被自動文件使用。
        * 也會被自動用戶端程式碼產生工具使用。
    * 使用 Pydantic 將回傳資料**序列化**為 JSON,而 Pydantic 是用 **Rust** 撰寫的,因此會 **更快很多**。
    
    但更重要的是:
    
    * 它會將輸出資料限制並過濾為回傳型別中定義的內容。
        * 這對安全性特別重要,下面會再看到更多細節。
    
    ## `response_model` 參數 { #response-model-parameter }
    
    有些情況下,你需要或想要回傳的資料與你宣告的型別不完全相同。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 14.5K bytes
    - Click Count (0)
  4. docs/zh-hant/docs/advanced/response-directly.md

    如果你沒有宣告回應模型,FastAPI 會使用在[JSON 相容編碼器](../tutorial/encoder.md)中說明的 `jsonable_encoder`,並把它放進 `JSONResponse`。
    
    但你也可以直接從路徑操作回傳 `JSONResponse`。
    
    /// tip
    
    通常使用 [回應模型](../tutorial/response-model.md) 會有更好的效能,因為那樣會在 Rust 端使用 Pydantic 來序列化資料,而不是直接回傳 `JSONResponse`。
    
    ///
    
    ## 回傳 `Response` { #return-a-response }
    
    其實,你可以回傳任何 `Response`,或其任何子類別。
    
    /// info
    
    `JSONResponse` 本身就是 `Response` 的子類別。
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 3.8K bytes
    - Click Count (0)
  5. doc/go_mem.html

    Some compiler optimizations that would be valid in single-threaded programs are not valid in all Go programs.
    In particular, a compiler must not introduce writes that do not exist in the original program,
    it must not allow a single read to observe multiple values,
    and it must not allow a single write to write multiple values.
    </p>
    
    <p>
    All the following examples assume that `*p` and `*q` refer to
    Created: Tue Apr 07 11:13:11 GMT 2026
    - Last Modified: Tue Aug 05 15:41:37 GMT 2025
    - 26.6K bytes
    - Click Count (0)
  6. docs/uk/docs/advanced/response-directly.md

    /// tip | Порада
    
    Зазвичай ви отримаєте значно кращу продуктивність, використовуючи [Модель відповіді](../tutorial/response-model.md), ніж повертаючи `JSONResponse` безпосередньо, адже так дані серіалізуються Pydantic на Rust.
    
    ///
    
    ## Повернення `Response` { #return-a-response }
    
    Ви можете повертати `Response` або будь-який його підклас.
    
    /// info | Інформація
    
    `JSONResponse` сам є підкласом `Response`.
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 6.7K bytes
    - Click Count (0)
  7. docs/ru/docs/advanced/response-directly.md

    ///
    
    ## Возврат `Response` { #return-a-response }
    
    Вы можете возвращать `Response` или любой его подкласс.
    
    /// info | Информация
    
    `JSONResponse` сам по себе является подклассом `Response`.
    
    ///
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 6.9K bytes
    - Click Count (0)
  8. docs/pt/docs/advanced/response-directly.md

    /// tip | Dica
    
    Normalmente você terá um desempenho muito melhor usando um [Modelo de resposta](../tutorial/response-model.md) do que retornando uma `JSONResponse` diretamente, pois assim ele serializa os dados usando o Pydantic, em Rust.
    
    ///
    
    ## Retornando uma `Response` { #return-a-response }
    
    Você pode retornar uma `Response` ou qualquer subclasse dela.
    
    /// info | Informação
    
    A própria `JSONResponse` é uma subclasse de `Response`.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 4.5K bytes
    - Click Count (0)
  9. docs/tr/docs/advanced/response-directly.md

    /// tip | İpucu
    
    [Response Model](../tutorial/response-model.md) kullanmak, doğrudan `JSONResponse` döndürmeye kıyasla genellikle çok daha iyi performans sağlar; çünkü veriyi Pydantic ile, Rust tarafında serialize eder.
    
    ///
    
    ## Bir `Response` Döndürme { #return-a-response }
    
    Aslında herhangi bir `Response` veya onun herhangi bir alt sınıfını döndürebilirsiniz.
    
    /// info | Bilgi
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  10. docs/zh/docs/advanced/response-directly.md

    然后,**FastAPI** 会在后台将这些兼容 JSON 的数据(比如字典)放到一个 `JSONResponse` 中,该 `JSONResponse` 会用来发送响应给客户端。
    
    但是你可以在你的 *路径操作* 中直接返回一个 `JSONResponse`。
    
    /// tip | 提示
    
    通常使用 [响应模型](../tutorial/response-model.md) 会比直接返回 `JSONResponse` 拥有更好的性能,因为它会在 Rust 中使用 Pydantic 序列化数据。
    
    ///
    
    ## 返回 `Response` { #return-a-response }
    
    事实上,你可以返回任意 `Response` 或者任意 `Response` 的子类。
    
    /// info | 信息
    
    `JSONResponse` 本身是一个 `Response` 的子类。
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 4.2K bytes
    - Click Count (0)
Back to Top