pub enum ListOrValue<T> {
    List(Vec<T>),
    Value(T),
}
Expand description

RPC list or value wrapper.

For some RPCs it’s convenient to call them with either a single value or a whole list of values to get a proper response. In theory you could do a batch query, but it’s:

  1. Less convenient in client libraries
  2. If the response value is small, the protocol overhead might be dominant.

Also it’s nice to be able to maintain backward compatibility for methods that were initially taking a value and now we want to expand them to take a list.

Variants

List(Vec<T>)

A list of values of given type.

Value(T)

A single value of given type.

Implementations

Map every contained value using function F.

This allows to easily convert all values in any of the variants.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.