Struct apollo_compiler::ast::Document
source · pub struct Document {
pub sources: SourceMap,
pub definitions: Vec<Definition>,
}
Fields§
§sources: SourceMap
If this document was originally parsed from a source file, this map contains one entry for that file and its ID.
The document may have been modified since.
definitions: Vec<Definition>
Implementations§
source§impl Document
impl Document
sourcepub fn parse(
source_text: impl Into<String>,
path: impl AsRef<Path>
) -> Result<Self, WithErrors<Self>>
pub fn parse( source_text: impl Into<String>, path: impl AsRef<Path> ) -> Result<Self, WithErrors<Self>>
Parse input
with the default configuration
path
is the filesystem path (or arbitrary string) used in diagnostics
to identify this source file to users.
sourcepub fn validate_standalone_executable(&self) -> Result<(), DiagnosticList>
pub fn validate_standalone_executable(&self) -> Result<(), DiagnosticList>
Validate as an executable document, as much as possible without a schema
sourcepub fn to_schema(&self) -> Result<Schema, WithErrors<Schema>>
pub fn to_schema(&self) -> Result<Schema, WithErrors<Schema>>
Build a schema with this AST document as its sole input.
sourcepub fn to_schema_validate(&self) -> Result<Valid<Schema>, WithErrors<Schema>>
pub fn to_schema_validate(&self) -> Result<Valid<Schema>, WithErrors<Schema>>
Build and validate a schema with this AST document as its sole input.
sourcepub fn to_executable(
&self,
schema: &Valid<Schema>
) -> Result<ExecutableDocument, WithErrors<ExecutableDocument>>
pub fn to_executable( &self, schema: &Valid<Schema> ) -> Result<ExecutableDocument, WithErrors<ExecutableDocument>>
Build an executable document from this AST, with the given schema
sourcepub fn to_executable_validate(
&self,
schema: &Valid<Schema>
) -> Result<Valid<ExecutableDocument>, WithErrors<ExecutableDocument>>
pub fn to_executable_validate( &self, schema: &Valid<Schema> ) -> Result<Valid<ExecutableDocument>, WithErrors<ExecutableDocument>>
Build and validate an executable document from this AST, with the given schema
sourcepub fn to_mixed_validate(
&self
) -> Result<(Valid<Schema>, Valid<ExecutableDocument>), DiagnosticList>
pub fn to_mixed_validate( &self ) -> Result<(Valid<Schema>, Valid<ExecutableDocument>), DiagnosticList>
Build a schema and executable document from this AST containing a mixture of type system definitions and executable definitions, and validate them. This is mostly useful for unit tests.
Trait Implementations§
source§impl PartialEq for Document
impl PartialEq for Document
source
is ignored for comparison
impl Eq for Document
Auto Trait Implementations§
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.