pub struct HostJsLib { /* private fields */ }Implementations§
Source§impl HostJsLib
impl HostJsLib
pub fn new(namespace: &str) -> Self
Sourcepub fn function<F, Fut>(self, path: &str, f: F) -> Selfwhere
F: Fn(HostCallContext, Value) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Value, HostJsError>> + Send + 'static,
pub fn function<F, Fut>(self, path: &str, f: F) -> Selfwhere
F: Fn(HostCallContext, Value) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Value, HostJsError>> + Send + 'static,
path is dot-separated JavaScript identifiers under the namespace:
flow.start is codix.flow.start(input) in a script.
Sourcepub fn prelude(self, js: impl Into<String>) -> Self
pub fn prelude(self, js: impl Into<String>) -> Self
Plain JavaScript evaluated after the stubs and before the plugin’s code, while the namespace can still be added to; frozen after.
Sourcepub fn description(self, text: impl Into<String>) -> Self
pub fn description(self, text: impl Into<String>) -> Self
What install disclosures say the library is.
pub fn namespace(&self) -> &str
pub fn paths(&self) -> impl Iterator<Item = &str>
pub fn function_at(&self, path: &str) -> Option<&Arc<dyn HostFn>>
pub fn prelude_source(&self) -> Option<&str>
Sourcepub fn library(&self) -> HostLibrary
pub fn library(&self) -> HostLibrary
The library as a package’s uses is checked against.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HostJsLib
impl !UnwindSafe for HostJsLib
impl Forget for HostJsLib
impl Freeze for HostJsLib
impl Move for HostJsLib
impl Send for HostJsLib
impl Sync for HostJsLib
impl Unpin for HostJsLib
impl UnsafeUnpin for HostJsLib
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