pub struct Execution<'a> { /* private fields */ }
Expand description
Builder for configuring GraphQL execution
Implementations§
Source§impl<'a> Execution<'a>
impl<'a> Execution<'a>
Sourcepub fn new(
schema: &'a Valid<Schema>,
document: &'a Valid<ExecutableDocument>,
) -> Self
pub fn new( schema: &'a Valid<Schema>, document: &'a Valid<ExecutableDocument>, ) -> Self
Create a new builder for configuring GraphQL execution
Sourcepub fn operation(self, operation: &'a Operation) -> Self
pub fn operation(self, operation: &'a Operation) -> Self
Sets the operation to execute.
Mutually exclusive with operation_name
.
Sourcepub fn operation_name(
self,
operation_name: Option<&str>,
) -> Result<Self, RequestError>
pub fn operation_name( self, operation_name: Option<&str>, ) -> Result<Self, RequestError>
Sets the operation to execute.
Mutually exclusive with operation
.
If neither is called or if None
is passed here,
the document is expected to contain exactly one operation.
See `document.operations.get()``.
Sourcepub fn implementers_map(
self,
implementers_map: &'a HashMap<Name, Implementers>,
) -> Self
pub fn implementers_map( self, implementers_map: &'a HashMap<Name, Implementers>, ) -> Self
Provide a pre-computed result of Schema::implementers_map
.
If not provided here, it will be computed lazily on demand and cached for the duration of execution.
Sourcepub fn coerced_variable_values(
self,
variable_values: &'a Valid<JsonMap>,
) -> Self
pub fn coerced_variable_values( self, variable_values: &'a Valid<JsonMap>, ) -> Self
Provide values of the request’s variables,
having already gone through coerce_variable_values
.
Mutually exclusive with raw_variable_values
.
If neither is used, an empty map is assumed.
Sourcepub fn raw_variable_values(self, variable_values: &'a JsonMap) -> Self
pub fn raw_variable_values(self, variable_values: &'a JsonMap) -> Self
Provide values of the request’s variables.
Mutually exclusive with coerced_variable_values
.
If neither is used, an empty map is assumed.
Sourcepub fn enable_schema_introspection(
self,
enable_schema_introspection: bool,
) -> Self
pub fn enable_schema_introspection( self, enable_schema_introspection: bool, ) -> Self
By default, schema introspection is disabled per the recommendation to do so in production:
the meta-field __schema
and __type
return a field error.
(__typename
is not affected, as it is always available.)
Setting this configuration to true
makes execution
generate the appropriate response data for those fields.
ObjectValue::resolve_field
or AsyncObjectValue::resolve_field
is never called
for meta-fields __typename
, __schema
, or __type
.
They are always handled implicitly.
Sourcepub fn execute_sync(
&self,
initial_value: &dyn ObjectValue,
) -> Result<ExecutionResponse, RequestError>
pub fn execute_sync( &self, initial_value: &dyn ObjectValue, ) -> Result<ExecutionResponse, RequestError>
Perform execution with synchronous resolvers
Sourcepub async fn execute_async(
&self,
initial_value: &dyn AsyncObjectValue,
) -> Result<ExecutionResponse, RequestError>
pub async fn execute_async( &self, initial_value: &dyn AsyncObjectValue, ) -> Result<ExecutionResponse, RequestError>
Perform execution with asynchronous resolvers
Auto Trait Implementations§
impl<'a> Freeze for Execution<'a>
impl<'a> RefUnwindSafe for Execution<'a>
impl<'a> Send for Execution<'a>
impl<'a> Sync for Execution<'a>
impl<'a> Unpin for Execution<'a>
impl<'a> UnwindSafe for Execution<'a>
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);