Skip to main content

export

Attribute Macro export 

Source
#[export]
Expand description

Export a function, or every pub fn of an interface’s impl block.

A function’s parameters may be values (T), borrows (&str, &[u8], &Store, &Entry, Option<&T>), or callback interfaces (Arc<dyn Trait>, Option<Arc<dyn Trait>>). It returns nothing, a value, a weaveffi::Iter<T> (lazily pulled), or a Result of one, whose error is a #[weaveffi::error] domain or an untyped error (weaveffi::Error, String, std::io::Error, …). An async fn is asynchronous, and cancellable when its last parameter is a weaveffi::CancelToken.

In an impl block, a member with &self (or self: Arc<Self>) is a method, a synchronous one returning the type (Self, Arc<Self>, or a Result of either) a constructor, and any other a static (so an async factory is a static that returns the interface).