Struct diplomat_core::ast::Method
source · [−]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: StringThe name of the method as initially declared.
docs: DocsLines of documentation for the method.
full_path_name: StringThe 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
sourceimpl Method
impl Method
sourcepub fn from_syn(m: &ImplItemMethod, self_path: &Path) -> Method
pub fn from_syn(m: &ImplItemMethod, self_path: &Path) -> Method
Extracts a Method from an AST node inside an impl.
sourcepub fn check_validity<'a>(
&'a self,
in_path: &Path,
env: &Env,
errors: &mut Vec<ValidityError>
)
pub fn check_validity<'a>(
&'a self,
in_path: &Path,
env: &Env,
errors: &mut Vec<ValidityError>
)
Performs type-specific validity checks (see TypeName::check_validity())
sourcepub fn is_writeable_out(&self) -> bool
pub fn is_writeable_out(&self) -> bool
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.
sourcepub fn has_writeable_param(&self) -> bool
pub fn has_writeable_param(&self) -> bool
Checks if any parameters are writeable (regardless of other compatibilities for writeable output)
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Method
impl<'de> Deserialize<'de> for Method
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Method
impl StructuralEq for Method
impl StructuralPartialEq for Method
Auto Trait Implementations
impl RefUnwindSafe for Method
impl Send for Method
impl Sync for Method
impl Unpin for Method
impl UnwindSafe for Method
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more