Struct apollo_compiler::validation::Valid
source · pub struct Valid<T>(/* private fields */);
Expand description
Wraps a Schema
or ExecutableDocument
to mark it
as valid.
This is obtained either by running validation with one of:
Schema::parse_and_validate
Schema::validate
ExecutableDocument::parse_and_validate
ExecutableDocument::validate
coerce_variable_values
… or by explicitly skipping it with Valid::assume_valid
.
The schema or document inside Valid<T>
is immutable (&mut T
is not given out).
It can be extracted with into_inner
,
such as to mutate it then possibly re-validate it.
Implementations§
source§impl<T> Valid<T>
impl<T> Valid<T>
sourcepub fn assume_valid(document: T) -> Self
pub fn assume_valid(document: T) -> Self
Construct a Valid
document without actually running validation.
This takes ownership of the document.
See also assume_valid_ref
which only requires a reference.
The caller takes responsibility to ascertain that the document is known through some other means to be valid. For example, if it was loaded from some external storage where it was only stored after validation.
sourcepub fn assume_valid_ref(document: &T) -> &Self
pub fn assume_valid_ref(document: &T) -> &Self
Mark a reference as Valid
without actually running validation.
See also assume_valid
returns an owned Valid<T>
instead of only a reference.
The caller takes responsibility to ascertain that the document is known through some other means to be valid. For example, if it was loaded from some external storage where it was only stored after validation.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Extract the schema or document, such as to mutate it then possibly re-validate it.
Trait Implementations§
source§impl<T: PartialEq> PartialEq for Valid<T>
impl<T: PartialEq> PartialEq for Valid<T>
impl<T: Eq> Eq for Valid<T>
impl<T> StructuralPartialEq for Valid<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Valid<T>where
T: RefUnwindSafe,
impl<T> Send for Valid<T>where
T: Send,
impl<T> Sync for Valid<T>where
T: Sync,
impl<T> Unpin for Valid<T>where
T: Unpin,
impl<T> UnwindSafe for Valid<T>where
T: UnwindSafe,
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.