Skip to main content

Method

Type Alias Method 

Source
pub type Method<'a> = Cow<'a, str>;
Expand description

A JSON-RPC method name, borrowed from the frame unless it needed unescaping.

A Cow rather than a &str for the same reason WireId is one: serde_json refuses to lend a borrow for a string containing an escape, and a peer may spell a method with one. The common case — tools/list written plainly — allocates nothing.

Aliased Type§

pub enum Method<'a> {
    Borrowed(&'a str),
    Owned(String),
}

Variants§

§1.0.0

Borrowed(&'a str)

Borrowed data.

§1.0.0

Owned(String)

Owned data.