pub trait AsyncSchemaLoader:
Send
+ Sync
+ Debug {
// Required methods
fn load_async(
&self,
location: &str,
) -> Pin<Box<dyn Future<Output = SchemaResult<String>> + Send + '_>>;
fn can_load(&self, location: &str) -> bool;
}Expand description
Trait for loading schema content asynchronously.
Implementations can provide truly non-blocking I/O for HTTP, cloud storage,
or other async sources. Pass a Box<dyn AsyncSchemaLoader> to
SchemaResolver::with_async_loader to enable async loading.
When no async loader is configured, async resolver methods fall back to the
sync SchemaLoader (blocking the current task).
The trait is object-safe (Pin<Box<dyn Future>>), so it can be stored as
Box<dyn AsyncSchemaLoader> without conflicting with sync trait impls.
Required Methods§
Sourcefn load_async(
&self,
location: &str,
) -> Pin<Box<dyn Future<Output = SchemaResult<String>> + Send + '_>>
fn load_async( &self, location: &str, ) -> Pin<Box<dyn Future<Output = SchemaResult<String>> + Send + '_>>
Load schema content asynchronously from the given location.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".