Sign in

    mizchi/crater-webdriver-bidi/rpc does not have a README file

    ApiMethod

    All API methods as an enum for JSON-RPC dispatch

    RpcErrorCode

    pub(all) enum RpcErrorCode {
    ParseError
    InvalidRequest
    MethodNotFound
    InvalidParams
    InternalError
    ElementNotFound
    PageNotFound
    Timeout
    NavigationFailed
    } derive(Eq,
    Debug
    )

    Standard JSON-RPC error codes

    RpcErrorCode::code

    fn RpcErrorCode::code(self : RpcErrorCode) -> Int

    Get numeric error code

    RpcId

    pub(all) enum RpcId {
    Num(Int)
    Str(String)
    Null
    } derive(Eq,
    Debug
    )

    JSON-RPC request ID (can be string or number)
    impl Show for RpcId

    RpcId::to_json

    fn RpcId::to_json(self : RpcId) -> String

    Serialize RpcId to JSON

    RpcRequest

    pub(all) struct RpcRequest {
    jsonrpc : String
    id : RpcId
    method_name : String
    params : Map[String, String]
    } derive(
    Debug
    )

    JSON-RPC request
    impl Show for RpcRequest

    RpcResponse

    pub(all) enum RpcResponse {
    Success(RpcId, String)
    Error(RpcId, Int, String, String?)
    } derive(
    Debug
    )

    JSON-RPC response
    impl Show for RpcResponse

    RpcResponse::to_json

    fn RpcResponse::to_json(self : RpcResponse) -> String

    Serialize RpcResponse to JSON

    api_error_to_rpc

    Convert ApiError to RpcResponse

    parse_json_object

    fn parse_json_object(json : String) -> Map[String, String]

    Parse a simple JSON object into a Map Note: This is a very simplified parser for demo purposes

    parse_method

    Parse method name to ApiMethod

    rpc_error

    fn rpc_error(id : RpcId, code : RpcErrorCode, message : String) -> RpcResponse

    Create error response

    rpc_error_with_data

    fn rpc_error_with_data(id : RpcId, code : RpcErrorCode, message : String, data : String) -> RpcResponse

    Create error response with data

    rpc_success_bool

    fn rpc_success_bool(id : RpcId, value : Bool) -> RpcResponse

    Create success response with bool result

    rpc_success_json

    fn rpc_success_json(id : RpcId, json : String) -> RpcResponse

    Create success response with raw JSON result

    rpc_success_null

    fn rpc_success_null(id : RpcId) -> RpcResponse

    Create success response with null result

    rpc_success_number

    fn rpc_success_number(id : RpcId, value : Double) -> RpcResponse

    Create success response with number result

    rpc_success_string

    fn rpc_success_string(id : RpcId, value : String) -> RpcResponse

    Create success response with string result

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io