Struct ClientSocket

Source
pub struct ClientSocket(/* private fields */);
Expand description

The socket for Language Server to communicate with the Language Client peer.

Implementations§

Source§

impl ClientSocket

Source

pub fn new_closed() -> Self

Create a closed socket outside a main loop. Any interaction will immediately return an error of Error::ServiceStopped.

This works as a placeholder where a socket is required but actually unused.

§Note

To prevent accidental misusages, this method is NOT implemented as Default::default intentionally.

Source

pub async fn request<R: Request>(&self, params: R::Params) -> Result<R::Result>

Send a request to the peer and wait for its response.

§Errors
Source

pub fn notify<N: Notification>(&self, params: N::Params) -> Result<()>

Send a notification to the peer and wait for its response.

This is done asynchronously. An Ok result indicates the message is successfully queued, but may not be sent to the peer yet.

§Errors
Source

pub fn emit<E: Send + 'static>(&self, event: E) -> Result<()>

Emit an arbitrary loopback event object to the service handler.

This is done asynchronously. An Ok result indicates the message is successfully queued, but may not be processed yet.

§Errors

Trait Implementations§

Source§

impl Clone for ClientSocket

Source§

fn clone(&self) -> ClientSocket

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientSocket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl LanguageClient for &ClientSocket

Source§

type Error = Error

Should always be defined to ResponseError for user implementations.
Source§

type NotifyResult = Result<(), Error>

Should always be defined to ControlFlow<Result<()>> for user implementations.
Source§

fn workspace_folders( &mut self, params: <WorkspaceFoldersRequest as Request>::Params, ) -> BoxFuture<'static, Result<<WorkspaceFoldersRequest as Request>::Result, Self::Error>>

Source§

fn configuration( &mut self, params: <WorkspaceConfiguration as Request>::Params, ) -> BoxFuture<'static, Result<<WorkspaceConfiguration as Request>::Result, Self::Error>>

Source§

fn work_done_progress_create( &mut self, params: <WorkDoneProgressCreate as Request>::Params, ) -> BoxFuture<'static, Result<<WorkDoneProgressCreate as Request>::Result, Self::Error>>

Source§

fn semantic_tokens_refresh( &mut self, params: <SemanticTokensRefresh as Request>::Params, ) -> BoxFuture<'static, Result<<SemanticTokensRefresh as Request>::Result, Self::Error>>

Source§

fn show_document( &mut self, params: <ShowDocument as Request>::Params, ) -> BoxFuture<'static, Result<<ShowDocument as Request>::Result, Self::Error>>

Source§

fn inline_value_refresh( &mut self, params: <InlineValueRefreshRequest as Request>::Params, ) -> BoxFuture<'static, Result<<InlineValueRefreshRequest as Request>::Result, Self::Error>>

Source§

fn inlay_hint_refresh( &mut self, params: <InlayHintRefreshRequest as Request>::Params, ) -> BoxFuture<'static, Result<<InlayHintRefreshRequest as Request>::Result, Self::Error>>

Source§

fn workspace_diagnostic_refresh( &mut self, params: <WorkspaceDiagnosticRefresh as Request>::Params, ) -> BoxFuture<'static, Result<<WorkspaceDiagnosticRefresh as Request>::Result, Self::Error>>

Source§

fn register_capability( &mut self, params: <RegisterCapability as Request>::Params, ) -> BoxFuture<'static, Result<<RegisterCapability as Request>::Result, Self::Error>>

Source§

fn unregister_capability( &mut self, params: <UnregisterCapability as Request>::Params, ) -> BoxFuture<'static, Result<<UnregisterCapability as Request>::Result, Self::Error>>

Source§

fn show_message_request( &mut self, params: <ShowMessageRequest as Request>::Params, ) -> BoxFuture<'static, Result<<ShowMessageRequest as Request>::Result, Self::Error>>

Source§

fn code_lens_refresh( &mut self, params: <CodeLensRefresh as Request>::Params, ) -> BoxFuture<'static, Result<<CodeLensRefresh as Request>::Result, Self::Error>>

Source§

fn apply_edit( &mut self, params: <ApplyWorkspaceEdit as Request>::Params, ) -> BoxFuture<'static, Result<<ApplyWorkspaceEdit as Request>::Result, Self::Error>>

Source§

fn show_message( &mut self, params: <ShowMessage as Notification>::Params, ) -> Self::NotifyResult

Source§

fn log_message( &mut self, params: <LogMessage as Notification>::Params, ) -> Self::NotifyResult

Source§

fn telemetry_event( &mut self, params: <TelemetryEvent as Notification>::Params, ) -> Self::NotifyResult

Source§

fn publish_diagnostics( &mut self, params: <PublishDiagnostics as Notification>::Params, ) -> Self::NotifyResult

Source§

fn log_trace( &mut self, params: <LogTrace as Notification>::Params, ) -> Self::NotifyResult

Source§

fn cancel_request( &mut self, params: <Cancel as Notification>::Params, ) -> Self::NotifyResult

Source§

fn progress( &mut self, params: <Progress as Notification>::Params, ) -> Self::NotifyResult

Source§

impl LanguageClient for ClientSocket

Source§

type Error = Error

Should always be defined to ResponseError for user implementations.
Source§

type NotifyResult = Result<(), Error>

Should always be defined to ControlFlow<Result<()>> for user implementations.
Source§

fn workspace_folders( &mut self, params: <WorkspaceFoldersRequest as Request>::Params, ) -> BoxFuture<'static, Result<<WorkspaceFoldersRequest as Request>::Result, Self::Error>>

Source§

fn configuration( &mut self, params: <WorkspaceConfiguration as Request>::Params, ) -> BoxFuture<'static, Result<<WorkspaceConfiguration as Request>::Result, Self::Error>>

Source§

fn work_done_progress_create( &mut self, params: <WorkDoneProgressCreate as Request>::Params, ) -> BoxFuture<'static, Result<<WorkDoneProgressCreate as Request>::Result, Self::Error>>

Source§

fn semantic_tokens_refresh( &mut self, params: <SemanticTokensRefresh as Request>::Params, ) -> BoxFuture<'static, Result<<SemanticTokensRefresh as Request>::Result, Self::Error>>

Source§

fn show_document( &mut self, params: <ShowDocument as Request>::Params, ) -> BoxFuture<'static, Result<<ShowDocument as Request>::Result, Self::Error>>

Source§

fn inline_value_refresh( &mut self, params: <InlineValueRefreshRequest as Request>::Params, ) -> BoxFuture<'static, Result<<InlineValueRefreshRequest as Request>::Result, Self::Error>>

Source§

fn inlay_hint_refresh( &mut self, params: <InlayHintRefreshRequest as Request>::Params, ) -> BoxFuture<'static, Result<<InlayHintRefreshRequest as Request>::Result, Self::Error>>

Source§

fn workspace_diagnostic_refresh( &mut self, params: <WorkspaceDiagnosticRefresh as Request>::Params, ) -> BoxFuture<'static, Result<<WorkspaceDiagnosticRefresh as Request>::Result, Self::Error>>

Source§

fn register_capability( &mut self, params: <RegisterCapability as Request>::Params, ) -> BoxFuture<'static, Result<<RegisterCapability as Request>::Result, Self::Error>>

Source§

fn unregister_capability( &mut self, params: <UnregisterCapability as Request>::Params, ) -> BoxFuture<'static, Result<<UnregisterCapability as Request>::Result, Self::Error>>

Source§

fn show_message_request( &mut self, params: <ShowMessageRequest as Request>::Params, ) -> BoxFuture<'static, Result<<ShowMessageRequest as Request>::Result, Self::Error>>

Source§

fn code_lens_refresh( &mut self, params: <CodeLensRefresh as Request>::Params, ) -> BoxFuture<'static, Result<<CodeLensRefresh as Request>::Result, Self::Error>>

Source§

fn apply_edit( &mut self, params: <ApplyWorkspaceEdit as Request>::Params, ) -> BoxFuture<'static, Result<<ApplyWorkspaceEdit as Request>::Result, Self::Error>>

Source§

fn show_message( &mut self, params: <ShowMessage as Notification>::Params, ) -> Self::NotifyResult

Source§

fn log_message( &mut self, params: <LogMessage as Notification>::Params, ) -> Self::NotifyResult

Source§

fn telemetry_event( &mut self, params: <TelemetryEvent as Notification>::Params, ) -> Self::NotifyResult

Source§

fn publish_diagnostics( &mut self, params: <PublishDiagnostics as Notification>::Params, ) -> Self::NotifyResult

Source§

fn log_trace( &mut self, params: <LogTrace as Notification>::Params, ) -> Self::NotifyResult

Source§

fn cancel_request( &mut self, params: <Cancel as Notification>::Params, ) -> Self::NotifyResult

Source§

fn progress( &mut self, params: <Progress as Notification>::Params, ) -> Self::NotifyResult

Source§

impl LspService for ClientSocket

Available on crate feature forward only.
Source§

fn notify(&mut self, notif: AnyNotification) -> ControlFlow<Result<()>>

Source§

fn emit(&mut self, event: AnyEvent) -> ControlFlow<Result<()>>

The handler of an arbitrary AnyEvent. Read more
Source§

impl Service<AnyRequest> for ClientSocket

Available on crate feature forward only.
Source§

type Response = Value

Responses given by the service.
Source§

type Error = ResponseError

Errors produced by the service.
Source§

type Future = PeerSocketResponseFuture

The future response value.
Source§

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
Source§

fn call(&mut self, req: AnyRequest) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T