Skip to main content

SchemaLoader

Trait SchemaLoader 

Source
pub trait SchemaLoader:
    Send
    + Sync
    + Debug {
    // Required methods
    fn load(&self, location: &str) -> SchemaResult<String>;
    fn can_load(&self, location: &str) -> bool;

    // Provided method
    fn priority(&self) -> i32 { ... }
}
Expand description

Trait for loading schema content from various sources.

Implementations can support file systems, HTTP, embedded resources, etc. The loader chain uses priority to determine which loader handles a request.

Required Methods§

Source

fn load(&self, location: &str) -> SchemaResult<String>

Load schema content from the given location.

Returns the schema content as a string, or an error if loading fails.

Source

fn can_load(&self, location: &str) -> bool

Check if this loader can handle the given location.

Used by LoaderChain to find an appropriate loader.

Provided Methods§

Source

fn priority(&self) -> i32

Priority for loader chain (higher = checked first).

Default is 0. Embedded loader uses 100 to be checked before file system.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§