pub struct APIBridgeImpl {
api_methods: Arc<RwLock<HashMap<String, APIMethodInfo>>>,
stats: Arc<RwLock<APIStats>>,
contexts: Arc<RwLock<HashMap<String, APIContext>>>,
}Expand description
VS Code API bridge for Grove
Fields§
§api_methods: Arc<RwLock<HashMap<String, APIMethodInfo>>>Registered API methods
stats: Arc<RwLock<APIStats>>API call statistics
contexts: Arc<RwLock<HashMap<String, APIContext>>>Active API contexts
Implementations§
Source§impl APIBridgeImpl
impl APIBridgeImpl
Sourcefn register_builtin_methods(&self)
fn register_builtin_methods(&self)
Register built-in VS Code API methods
Sourcepub async fn register_method(
&self,
name: &str,
description: &str,
parameters: Option<Value>,
returns: Option<Value>,
is_async: bool,
) -> Result<()>
pub async fn register_method( &self, name: &str, description: &str, parameters: Option<Value>, returns: Option<Value>, is_async: bool, ) -> Result<()>
Register a custom API method
Sourcepub async fn create_context(&self, extension_id: &str) -> Result<APIContext>
pub async fn create_context(&self, extension_id: &str) -> Result<APIContext>
Create an API context for an extension
Sourcepub async fn get_context(&self, context_id: &str) -> Option<APIContext>
pub async fn get_context(&self, context_id: &str) -> Option<APIContext>
Get an API context
Sourcepub async fn update_context(&self, context: APIContext) -> Result<()>
pub async fn update_context(&self, context: APIContext) -> Result<()>
Update an API context
Sourcepub async fn remove_context(&self, context_id: &str) -> Result<bool>
pub async fn remove_context(&self, context_id: &str) -> Result<bool>
Remove an API context
Sourcepub async fn handle_call(
&self,
request: APICallRequest,
) -> Result<APICallResponse>
pub async fn handle_call( &self, request: APICallRequest, ) -> Result<APICallResponse>
Handle an API call from an extension
Sourceasync fn execute_method(
&self,
_extension_id: &str,
_method_name: &str,
_arguments: &[Value],
) -> Result<Value>
async fn execute_method( &self, _extension_id: &str, _method_name: &str, _arguments: &[Value], ) -> Result<Value>
Execute an API method
Sourcepub async fn get_methods(&self) -> Vec<APIMethodInfo>
pub async fn get_methods(&self) -> Vec<APIMethodInfo>
Get registered API methods
Sourcepub async fn unregister_method(&self, name: &str) -> Result<bool>
pub async fn unregister_method(&self, name: &str) -> Result<bool>
Unregister an API method
Trait Implementations§
Auto Trait Implementations§
impl Freeze for APIBridgeImpl
impl !RefUnwindSafe for APIBridgeImpl
impl Send for APIBridgeImpl
impl Sync for APIBridgeImpl
impl Unpin for APIBridgeImpl
impl !UnwindSafe for APIBridgeImpl
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request