pub struct HostCallbacks {
pub fs_read: Arc<dyn Fn(&str) -> String + Send + Sync>,
pub fs_list: Arc<dyn Fn(&str) -> String + Send + Sync>,
pub http_request: Arc<dyn Fn(&str) -> String + Send + Sync>,
pub git_status: Arc<dyn Fn() -> String + Send + Sync>,
pub git_diff: Arc<dyn Fn() -> String + Send + Sync>,
}Expand description
Host callback functions that the WASM module can call.
Each callback receives a string input and returns a string output.
Errors are returned as JSON: {"error": "message"}.
Fields§
§fs_read: Arc<dyn Fn(&str) -> String + Send + Sync>Read a project file. Input: path. Output: file content or error JSON.
fs_list: Arc<dyn Fn(&str) -> String + Send + Sync>List a project directory. Input: path. Output: JSON array of names or error JSON.
http_request: Arc<dyn Fn(&str) -> String + Send + Sync>Make an HTTP request. Input: JSON {method, url, body}. Output: JSON response or error JSON.
git_status: Arc<dyn Fn() -> String + Send + Sync>Get git status. Input: empty. Output: git status text or error JSON.
git_diff: Arc<dyn Fn() -> String + Send + Sync>Get git diff. Input: empty. Output: git diff text or error JSON.
Trait Implementations§
Source§impl Clone for HostCallbacks
impl Clone for HostCallbacks
Source§fn clone(&self) -> HostCallbacks
fn clone(&self) -> HostCallbacks
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for HostCallbacks
impl !UnwindSafe for HostCallbacks
impl Freeze for HostCallbacks
impl Send for HostCallbacks
impl Sync for HostCallbacks
impl Unpin for HostCallbacks
impl UnsafeUnpin for HostCallbacks
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more