描述元模組函式 (實驗功能)
bookmark_borderbookmark
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
protorpc.remote
套件提供下列函式:
- is_error_status(status)
-
判斷 RPC 狀態是否為錯誤。
引數
- 狀態
- 已初始化 RpcStatus 訊息,以便檢查錯誤。
- check_rpc_status(status)
-
將錯誤狀態轉換為已引發的例外狀況。
引數
- 狀態
- 已初始化 RpcStatus 訊息,以便檢查錯誤。
如果 status
的狀態為錯誤,即會引發 RpcError。
- method(request_type=message_types.VoidMessage, response_type=message_types.VoidMessage)
-
修飾某個方法,讓該方法變為遠端方法。
引數
- request_type=message_types.VoidMessage
- 預期要求的訊息類型。
- response_type=message_types.VoidMessage
- 預期回應的訊息類型。
傳回經過修飾後的遠端方法。遠端方法會包含 remote
屬性,其中包含下列屬性:
- method
- 原始未經修飾的方法
- request_type
- 預期要求的訊息類型。
- response_type
- 預期回應的訊息類型。
如果 request_type
或 response_type
參數不是正確的 messages.Message 子類別,則會引發 TypeError。
- get_remote_method(method)
-
針對遠端方法,傳回遠端方法資訊物件,否則傳回 None。
引數
- method
- 要取得的方法。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-05-13 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-05-13 (世界標準時間)。"],[[["`is_error_status(status)` checks if an `RpcStatus` message indicates an error."],["`check_rpc_status(status)` raises an `RpcError` exception if the provided `RpcStatus` message indicates an error."],["`method()` decorates a method to make it remote, defining its request and response message types."],["`get_remote_method(method)` retrieves remote method information for a given method or returns `None` if it's not a remote method."]]],[]]