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

    RpcErrorCode::equal

    RpcErrorCode::not_equal

    fn RpcErrorCode::not_equal(x : RpcErrorCode, y : RpcErrorCode) -> Bool

    RpcErrorCode::output

    fn RpcErrorCode::output(self : RpcErrorCode, logger : &Logger) -> Unit

    RpcErrorCode::to_string

    fn RpcErrorCode::to_string(self : RpcErrorCode) -> String

    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::equal

    fn RpcId::equal(RpcId, RpcId) -> Bool

    RpcId::not_equal

    fn RpcId::not_equal(x : RpcId, y : RpcId) -> Bool

    RpcId::output

    fn RpcId::output(self : RpcId, logger : &Logger) -> Unit

    RpcId::to_json

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

    Serialize RpcId to JSON

    RpcId::to_repr

    RpcId::to_string

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

    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

    RpcRequest::output

    fn RpcRequest::output(self : RpcRequest, logger : &Logger) -> Unit

    RpcRequest::to_string

    fn RpcRequest::to_string(self : RpcRequest) -> String

    RpcResponse

    pub(all) enum RpcResponse {
    Success(id~ : RpcId, result~ : String)
    Error(id~ : RpcId, code~ : Int, message~ : String, data~ : String?)
    } derive(
    Debug
    )

    JSON-RPC response
    impl Show for RpcResponse

    RpcResponse::output

    fn RpcResponse::output(self : RpcResponse, logger : &Logger) -> Unit

    RpcResponse::to_json

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

    Serialize RpcResponse to JSON

    RpcResponse::to_string

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

    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