Struct Method

Source
pub struct Method {
Show 13 fields pub name: String, pub tags: Vec<RefOr<Tag>>, pub summary: Option<String>, pub description: Option<String>, pub external_docs: Option<ExternalDocumentation>, pub params: Vec<RefOr<ContentDescriptor>>, pub result: Option<RefOr<ContentDescriptor>>, pub deprecated: bool, pub servers: Option<Vec<Server>>, pub errors: Vec<RefOr<Error>>, pub links: Vec<RefOr<Link>>, pub param_structure: ParamStructure, pub examples: Vec<RefOr<ExamplePairing>>,
}
Expand description

Describes the interface for the given method name.

The method name is used as the method field of the JSON-RPC body. It therefore must be unique.

Fields§

§name: String

The cannonical name of the method.

This name must be unique within the methods array.

§tags: Vec<RefOr<Tag>>

A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier.

§summary: Option<String>

A short summary of what the method does.

§description: Option<String>

A verbose explanation of the method behavior.

GitHub Flavored Markdown syntax may be used for rich text representation.

§external_docs: Option<ExternalDocumentation>

Additional external documentation for this method.

§params: Vec<RefOr<ContentDescriptor>>

A list of parameters that are applicable for this method.

The list must not include duplicated parameters and therefore require name to be unique.

All required parameters must be listed before any optional parameters.

§result: Option<RefOr<ContentDescriptor>>

The description of the result returned by the method.

If defined, it must be a ContentDescriptor or a [Reference].

If undefined, the method must only be used as a notification.

§deprecated: bool

Declares this method as deprecated.

Consumers should refrain from usage of the declared method.

The default value is false.

§servers: Option<Vec<Server>>

An alternative servers array to service this method.

If specified, it overrides the servers array defined at the root level.

§errors: Vec<RefOr<Error>>

A list of custom application-defined errors that may be returned.

The errors must have unique error codes.

§links: Vec<RefOr<Link>>

A list of possible links from this method call.

§param_structure: ParamStructure

The expected format of the parameters.

The parameters of a method may be an array, an object, or either. When a method has a param_structure value of ByName, callers of the method must pass an object as the parameters. When a method has a param_structure value of ByPosition, callers of the method must pass an array as the parameters. Otherwise, callers may pass either an array or an object as the parameters.

The default value is Either.

§examples: Vec<RefOr<ExamplePairing>>

An array of ExamplePairing objects, where each example includes a valid params-to-result ContentDescriptor pairing.

Trait Implementations§

Source§

impl Clone for Method

Source§

fn clone(&self) -> Method

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Method

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Method

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Method

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Method

§

impl RefUnwindSafe for Method

§

impl Send for Method

§

impl Sync for Method

§

impl Unpin for Method

§

impl UnwindSafe for Method

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,