pub trait FileProvider:
Send
+ Sync
+ 'static {
// Required method
fn read_text(
&self,
uri: &Uri,
) -> impl Future<Output = Result<Option<String>, WorkspaceError>> + TaskSend;
}Expand description
Supplies text for resources that are not open in the editor.
A successful Some result becomes a version-less Document snapshot;
Ok(None) means the provider has no resource for the URI and becomes
WorkspaceError::NotFound. Providers report failures — an unsupported
scheme, unreadable bytes, or an I/O error — through WorkspaceError, and
never cache: every lookup asks the provider again.
The returned future is Send on native targets and may remain local on
Worker-hosted WASM, matching the framework’s runtime task boundary.
Required Methods§
Sourcefn read_text(
&self,
uri: &Uri,
) -> impl Future<Output = Result<Option<String>, WorkspaceError>> + TaskSend
fn read_text( &self, uri: &Uri, ) -> impl Future<Output = Result<Option<String>, WorkspaceError>> + TaskSend
Read UTF-8 text for uri, returning None when the resource does not
exist and WorkspaceError for other failures.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".