pub struct Function {
pub name: String,
pub kind: FunctionKind,
pub params: Params,
pub results: Results,
pub docs: Docs,
pub stability: Stability,
}
Fields§
§name: String
§kind: FunctionKind
§params: Params
§results: Results
§docs: Docs
§stability: Stability
Stability attribute for this function.
Implementations§
Source§impl Function
impl Function
pub fn item_name(&self) -> &str
Sourcepub fn parameter_and_result_types(&self) -> impl Iterator<Item = Type> + '_
pub fn parameter_and_result_types(&self) -> impl Iterator<Item = Type> + '_
Returns an iterator over the types used in parameters and results.
Note that this iterator is not transitive, it only iterates over the direct references to types that this function has.
Sourcepub fn standard32_core_export_name<'a>(
&'a self,
interface: Option<&str>,
) -> Cow<'a, str>
pub fn standard32_core_export_name<'a>( &'a self, interface: Option<&str>, ) -> Cow<'a, str>
Gets the core export name for this function.
pub fn legacy_core_export_name<'a>( &'a self, interface: Option<&str>, ) -> Cow<'a, str>
Sourcepub fn core_export_name<'a>(
&'a self,
interface: Option<&str>,
mangling: Mangling,
) -> Cow<'a, str>
pub fn core_export_name<'a>( &'a self, interface: Option<&str>, mangling: Mangling, ) -> Cow<'a, str>
Gets the core export name for this function.
Sourcepub fn find_futures_and_streams(&self, resolve: &Resolve) -> Vec<TypeId>
pub fn find_futures_and_streams(&self, resolve: &Resolve) -> Vec<TypeId>
Collect any future and stream types appearing in the signature of this function by doing a depth-first search over the parameter types and then the result types.
For example, given the WIT function foo: func(x: future<future<u32>>, y: u32) -> stream<u8>
, we would return [future<u32>, future<future<u32>>, stream<u8>]
.
This may be used by binding generators to refer to specific future
and
stream
types when importing canonical built-ins such as stream.new
,
future.read
, etc. Using the example above, the import
[future-new-0]foo
would indicate a call to future.new
for the type
future<u32>
. Likewise, [future-new-1]foo
would indicate a call to
future.new
for future<future<u32>>
, and [stream-new-2]foo
would
indicate a call to stream.new
for stream<u8>
.
Trait Implementations§
impl Eq for Function
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.