[go: up one dir, main page]

pub struct Method {
    pub name: String,
    pub docs: Docs,
    pub full_path_name: String,
    pub self_param: Option<Param>,
    pub params: Vec<Param>,
    pub return_type: Option<TypeName>,
}
Expand description

A method declared in the impl associated with an FFI struct. Includes both static and non-static methods, which can be distinguished by inspecting Method::self_param.

Fields

name: String

The name of the method as initially declared.

docs: Docs

Lines of documentation for the method.

full_path_name: String

The name of the FFI function wrapping around the method.

self_param: Option<Param>

The self param of the method, if any.

params: Vec<Param>

All non-self params taken by the method.

return_type: Option<TypeName>

The return type of the method, if any.

Implementations

Extracts a Method from an AST node inside an impl.

Performs type-specific validity checks (see TypeName::check_validity())

Checks whether the method qualifies for special writeable handling. To qualify, a method must:

  • not return any value
  • have the last argument be an &mut diplomat_runtime::DiplomatWriteable

Typically, methods of this form will be transformed in the bindings to a method that doesn’t take the writeable as an argument but instead creates one locally and just returns the final string.

Checks if any parameters are writeable (regardless of other compatibilities for writeable output)

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

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.