pub struct ApiFunction {
pub name: String,
pub doc: Option<String>,
pub kind: ApiFunctionKind,
pub is_async: bool,
pub params: Vec<ApiParam>,
pub result: Option<String>,
}Expand description
One function within an interface.
Resource methods are functions too: WIT names them [method]<resource>.<name>
([static]…, [constructor]<resource> likewise) and kind
says which resource they belong to.
Fields§
§name: StringThe WIT function name, e.g. walk or [method]document.line.
doc: Option<String>The function’s /// doc comment, if any.
kind: ApiFunctionKindFreestanding, or which resource it is a method / static / constructor of.
is_async: boolDeclared async in the WIT.
params: Vec<ApiParam>Parameters in order. A method’s first parameter is self.
result: Option<String>The result type in WIT syntax, or None for a function returning nothing.
Implementations§
Source§impl ApiFunction
impl ApiFunction
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
The name a reader calls it by: walk, document.line,
document.new for a constructor. Strips WIT’s [method] /
[static] / [constructor] mangling.
Trait Implementations§
Source§impl Clone for ApiFunction
impl Clone for ApiFunction
Source§fn clone(&self) -> ApiFunction
fn clone(&self) -> ApiFunction
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiFunction
impl Debug for ApiFunction
impl Eq for ApiFunction
Source§impl PartialEq for ApiFunction
impl PartialEq for ApiFunction
impl StructuralPartialEq for ApiFunction
Auto Trait Implementations§
impl Freeze for ApiFunction
impl RefUnwindSafe for ApiFunction
impl Send for ApiFunction
impl Sync for ApiFunction
impl Unpin for ApiFunction
impl UnsafeUnpin for ApiFunction
impl UnwindSafe for ApiFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more