Struct apollo_compiler::ast::Document
source · pub struct Document {
pub sources: SourceMap,
pub definitions: Vec<Definition>,
}Fields§
§sources: SourceMapIf 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_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_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
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.