pub struct CompiledSchemaLoader { /* private fields */ }Expand description
Loader for compiled GraphQL schemas from JSON files.
Loads and caches a compiled schema from a JSON file on disk. Used during server startup to prepare the schema for query execution.
Implementations§
Source§impl CompiledSchemaLoader
impl CompiledSchemaLoader
Sourcepub async fn load(&self) -> Result<CompiledSchema, SchemaLoadError>
pub async fn load(&self) -> Result<CompiledSchema, SchemaLoadError>
Load schema from file.
Reads the schema JSON file, parses it, and returns a CompiledSchema.
§Errors
Returns SchemaLoadError::NotFound if the file does not exist.
Returns SchemaLoadError::IoError if the file cannot be read.
Returns SchemaLoadError::ParseError if the JSON is malformed.
Returns SchemaLoadError::ValidationError if schema validation fails.
§Example
// Requires: schema.compiled.json file on disk.
let loader = CompiledSchemaLoader::new("schema.compiled.json");
let schema = loader.load().await?;Trait Implementations§
Source§impl Clone for CompiledSchemaLoader
impl Clone for CompiledSchemaLoader
Source§fn clone(&self) -> CompiledSchemaLoader
fn clone(&self) -> CompiledSchemaLoader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompiledSchemaLoader
impl RefUnwindSafe for CompiledSchemaLoader
impl Send for CompiledSchemaLoader
impl Sync for CompiledSchemaLoader
impl Unpin for CompiledSchemaLoader
impl UnsafeUnpin for CompiledSchemaLoader
impl UnwindSafe for CompiledSchemaLoader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 more