pub struct CompiledSchema { /* private fields */ }Expand description
A Schema paired with its precomputed [SymEntities].
Building [SymEntities] from a schema is expensive and depends only on the
schema, not on any particular request environment. CompiledSchema computes it
once so it can be reused across many request environments via
CompiledSchema::sym_env, which is significantly cheaper than rebuilding the
symbolic entities per environment (as SymEnv::new does).
Implementations§
Source§impl CompiledSchema
impl CompiledSchema
Sourcepub fn new(schema: &Schema) -> Result<Self>
pub fn new(schema: &Schema) -> Result<Self>
Builds the symbolic entities for schema once, up front.
Sourcepub fn sym_env(&self, req_env: &RequestEnv) -> Result<SymEnv>
pub fn sym_env(&self, req_env: &RequestEnv) -> Result<SymEnv>
Returns a SymEnv for req_env, reusing the precomputed [SymEntities].
Only the (cheap) symbolic request is built per call; the (expensive)
symbolic entities are shared via a reference-counted clone. The resulting
SymEnv is identical to one built by SymEnv::new for the same
schema and request environment.
Trait Implementations§
Source§impl Clone for CompiledSchema
impl Clone for CompiledSchema
Source§fn clone(&self) -> CompiledSchema
fn clone(&self) -> CompiledSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for CompiledSchema
impl RefUnwindSafe for CompiledSchema
impl Send for CompiledSchema
impl Sync for CompiledSchema
impl Unpin for CompiledSchema
impl UnsafeUnpin for CompiledSchema
impl UnwindSafe for CompiledSchema
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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