pub enum Definition {
Show 17 variants
OperationDefinition(Node<OperationDefinition>),
FragmentDefinition(Node<FragmentDefinition>),
DirectiveDefinition(Node<DirectiveDefinition>),
SchemaDefinition(Node<SchemaDefinition>),
ScalarTypeDefinition(Node<ScalarTypeDefinition>),
ObjectTypeDefinition(Node<ObjectTypeDefinition>),
InterfaceTypeDefinition(Node<InterfaceTypeDefinition>),
UnionTypeDefinition(Node<UnionTypeDefinition>),
EnumTypeDefinition(Node<EnumTypeDefinition>),
InputObjectTypeDefinition(Node<InputObjectTypeDefinition>),
SchemaExtension(Node<SchemaExtension>),
ScalarTypeExtension(Node<ScalarTypeExtension>),
ObjectTypeExtension(Node<ObjectTypeExtension>),
InterfaceTypeExtension(Node<InterfaceTypeExtension>),
UnionTypeExtension(Node<UnionTypeExtension>),
EnumTypeExtension(Node<EnumTypeExtension>),
InputObjectTypeExtension(Node<InputObjectTypeExtension>),
}
Expand description
AST for a top-level Definition of any kind: executable, type system, or type system extension.
Variants§
OperationDefinition(Node<OperationDefinition>)
FragmentDefinition(Node<FragmentDefinition>)
DirectiveDefinition(Node<DirectiveDefinition>)
SchemaDefinition(Node<SchemaDefinition>)
ScalarTypeDefinition(Node<ScalarTypeDefinition>)
ObjectTypeDefinition(Node<ObjectTypeDefinition>)
InterfaceTypeDefinition(Node<InterfaceTypeDefinition>)
UnionTypeDefinition(Node<UnionTypeDefinition>)
EnumTypeDefinition(Node<EnumTypeDefinition>)
InputObjectTypeDefinition(Node<InputObjectTypeDefinition>)
SchemaExtension(Node<SchemaExtension>)
ScalarTypeExtension(Node<ScalarTypeExtension>)
ObjectTypeExtension(Node<ObjectTypeExtension>)
InterfaceTypeExtension(Node<InterfaceTypeExtension>)
UnionTypeExtension(Node<UnionTypeExtension>)
EnumTypeExtension(Node<EnumTypeExtension>)
InputObjectTypeExtension(Node<InputObjectTypeExtension>)
Implementations§
Source§impl Definition
impl Definition
Sourcepub fn is_executable_definition(&self) -> bool
pub fn is_executable_definition(&self) -> bool
Returns true if this is an executable definition (operation or fragment).
Sourcepub fn is_extension_definition(&self) -> bool
pub fn is_extension_definition(&self) -> bool
Returns true if this is an extension of another definition.
Sourcepub fn location(&self) -> Option<SourceSpan>
pub fn location(&self) -> Option<SourceSpan>
If this node was parsed from a source file, returns the file ID and source span (start and end byte offsets) within that file.
Sourcepub fn name(&self) -> Option<&Name>
pub fn name(&self) -> Option<&Name>
Return the name of this type definition or extension.
Operations may be anonymous, and schema definitions and extensions never have a name.
In those cases this method returns None
.
pub fn directives(&self) -> &DirectiveList
pub fn as_operation_definition(&self) -> Option<&Node<OperationDefinition>>
pub fn as_fragment_definition(&self) -> Option<&Node<FragmentDefinition>>
pub fn as_directive_definition(&self) -> Option<&Node<DirectiveDefinition>>
pub fn as_schema_definition(&self) -> Option<&Node<SchemaDefinition>>
pub fn as_scalar_type_definition(&self) -> Option<&Node<ScalarTypeDefinition>>
pub fn as_object_type_definition(&self) -> Option<&Node<ObjectTypeDefinition>>
pub fn as_interface_type_definition( &self, ) -> Option<&Node<InterfaceTypeDefinition>>
pub fn as_union_type_definition(&self) -> Option<&Node<UnionTypeDefinition>>
pub fn as_enum_type_definition(&self) -> Option<&Node<EnumTypeDefinition>>
pub fn as_input_object_type_definition( &self, ) -> Option<&Node<InputObjectTypeDefinition>>
pub fn as_schema_extension(&self) -> Option<&Node<SchemaExtension>>
pub fn as_scalar_type_extension(&self) -> Option<&Node<ScalarTypeExtension>>
pub fn as_object_type_extension(&self) -> Option<&Node<ObjectTypeExtension>>
pub fn as_interface_type_extension( &self, ) -> Option<&Node<InterfaceTypeExtension>>
pub fn as_union_type_extension(&self) -> Option<&Node<UnionTypeExtension>>
pub fn as_enum_type_extension(&self) -> Option<&Node<EnumTypeExtension>>
pub fn as_input_object_type_extension( &self, ) -> Option<&Node<InputObjectTypeExtension>>
Trait Implementations§
Source§impl Clone for Definition
impl Clone for Definition
Source§fn clone(&self) -> Definition
fn clone(&self) -> Definition
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Definition
impl Debug for Definition
Source§impl Display for Definition
Serialize to GraphQL syntax with the default configuration
impl Display for Definition
Serialize to GraphQL syntax with the default configuration
Source§impl From<DirectiveDefinition> for Definition
impl From<DirectiveDefinition> for Definition
Source§fn from(def: DirectiveDefinition) -> Self
fn from(def: DirectiveDefinition) -> Self
Source§impl From<EnumTypeDefinition> for Definition
impl From<EnumTypeDefinition> for Definition
Source§fn from(def: EnumTypeDefinition) -> Self
fn from(def: EnumTypeDefinition) -> Self
Source§impl From<EnumTypeExtension> for Definition
impl From<EnumTypeExtension> for Definition
Source§fn from(def: EnumTypeExtension) -> Self
fn from(def: EnumTypeExtension) -> Self
Source§impl From<FragmentDefinition> for Definition
impl From<FragmentDefinition> for Definition
Source§fn from(def: FragmentDefinition) -> Self
fn from(def: FragmentDefinition) -> Self
Source§impl From<InputObjectTypeDefinition> for Definition
impl From<InputObjectTypeDefinition> for Definition
Source§fn from(def: InputObjectTypeDefinition) -> Self
fn from(def: InputObjectTypeDefinition) -> Self
Source§impl From<InputObjectTypeExtension> for Definition
impl From<InputObjectTypeExtension> for Definition
Source§fn from(def: InputObjectTypeExtension) -> Self
fn from(def: InputObjectTypeExtension) -> Self
Source§impl From<InterfaceTypeDefinition> for Definition
impl From<InterfaceTypeDefinition> for Definition
Source§fn from(def: InterfaceTypeDefinition) -> Self
fn from(def: InterfaceTypeDefinition) -> Self
Source§impl From<InterfaceTypeExtension> for Definition
impl From<InterfaceTypeExtension> for Definition
Source§fn from(def: InterfaceTypeExtension) -> Self
fn from(def: InterfaceTypeExtension) -> Self
Source§impl From<Node<DirectiveDefinition>> for Definition
impl From<Node<DirectiveDefinition>> for Definition
Source§fn from(def: Node<DirectiveDefinition>) -> Self
fn from(def: Node<DirectiveDefinition>) -> Self
Source§impl From<Node<EnumTypeDefinition>> for Definition
impl From<Node<EnumTypeDefinition>> for Definition
Source§fn from(def: Node<EnumTypeDefinition>) -> Self
fn from(def: Node<EnumTypeDefinition>) -> Self
Source§impl From<Node<EnumTypeExtension>> for Definition
impl From<Node<EnumTypeExtension>> for Definition
Source§fn from(def: Node<EnumTypeExtension>) -> Self
fn from(def: Node<EnumTypeExtension>) -> Self
Source§impl From<Node<FragmentDefinition>> for Definition
impl From<Node<FragmentDefinition>> for Definition
Source§fn from(def: Node<FragmentDefinition>) -> Self
fn from(def: Node<FragmentDefinition>) -> Self
Source§impl From<Node<InputObjectTypeDefinition>> for Definition
impl From<Node<InputObjectTypeDefinition>> for Definition
Source§fn from(def: Node<InputObjectTypeDefinition>) -> Self
fn from(def: Node<InputObjectTypeDefinition>) -> Self
Source§impl From<Node<InputObjectTypeExtension>> for Definition
impl From<Node<InputObjectTypeExtension>> for Definition
Source§fn from(def: Node<InputObjectTypeExtension>) -> Self
fn from(def: Node<InputObjectTypeExtension>) -> Self
Source§impl From<Node<InterfaceTypeDefinition>> for Definition
impl From<Node<InterfaceTypeDefinition>> for Definition
Source§fn from(def: Node<InterfaceTypeDefinition>) -> Self
fn from(def: Node<InterfaceTypeDefinition>) -> Self
Source§impl From<Node<InterfaceTypeExtension>> for Definition
impl From<Node<InterfaceTypeExtension>> for Definition
Source§fn from(def: Node<InterfaceTypeExtension>) -> Self
fn from(def: Node<InterfaceTypeExtension>) -> Self
Source§impl From<Node<ObjectTypeDefinition>> for Definition
impl From<Node<ObjectTypeDefinition>> for Definition
Source§fn from(def: Node<ObjectTypeDefinition>) -> Self
fn from(def: Node<ObjectTypeDefinition>) -> Self
Source§impl From<Node<ObjectTypeExtension>> for Definition
impl From<Node<ObjectTypeExtension>> for Definition
Source§fn from(def: Node<ObjectTypeExtension>) -> Self
fn from(def: Node<ObjectTypeExtension>) -> Self
Source§impl From<Node<OperationDefinition>> for Definition
impl From<Node<OperationDefinition>> for Definition
Source§fn from(def: Node<OperationDefinition>) -> Self
fn from(def: Node<OperationDefinition>) -> Self
Source§impl From<Node<ScalarTypeDefinition>> for Definition
impl From<Node<ScalarTypeDefinition>> for Definition
Source§fn from(def: Node<ScalarTypeDefinition>) -> Self
fn from(def: Node<ScalarTypeDefinition>) -> Self
Source§impl From<Node<ScalarTypeExtension>> for Definition
impl From<Node<ScalarTypeExtension>> for Definition
Source§fn from(def: Node<ScalarTypeExtension>) -> Self
fn from(def: Node<ScalarTypeExtension>) -> Self
Source§impl From<Node<SchemaDefinition>> for Definition
impl From<Node<SchemaDefinition>> for Definition
Source§fn from(def: Node<SchemaDefinition>) -> Self
fn from(def: Node<SchemaDefinition>) -> Self
Source§impl From<Node<SchemaExtension>> for Definition
impl From<Node<SchemaExtension>> for Definition
Source§fn from(def: Node<SchemaExtension>) -> Self
fn from(def: Node<SchemaExtension>) -> Self
Source§impl From<Node<UnionTypeDefinition>> for Definition
impl From<Node<UnionTypeDefinition>> for Definition
Source§fn from(def: Node<UnionTypeDefinition>) -> Self
fn from(def: Node<UnionTypeDefinition>) -> Self
Source§impl From<Node<UnionTypeExtension>> for Definition
impl From<Node<UnionTypeExtension>> for Definition
Source§fn from(def: Node<UnionTypeExtension>) -> Self
fn from(def: Node<UnionTypeExtension>) -> Self
Source§impl From<ObjectTypeDefinition> for Definition
impl From<ObjectTypeDefinition> for Definition
Source§fn from(def: ObjectTypeDefinition) -> Self
fn from(def: ObjectTypeDefinition) -> Self
Source§impl From<ObjectTypeExtension> for Definition
impl From<ObjectTypeExtension> for Definition
Source§fn from(def: ObjectTypeExtension) -> Self
fn from(def: ObjectTypeExtension) -> Self
Source§impl From<OperationDefinition> for Definition
impl From<OperationDefinition> for Definition
Source§fn from(def: OperationDefinition) -> Self
fn from(def: OperationDefinition) -> Self
Source§impl From<ScalarTypeDefinition> for Definition
impl From<ScalarTypeDefinition> for Definition
Source§fn from(def: ScalarTypeDefinition) -> Self
fn from(def: ScalarTypeDefinition) -> Self
Source§impl From<ScalarTypeExtension> for Definition
impl From<ScalarTypeExtension> for Definition
Source§fn from(def: ScalarTypeExtension) -> Self
fn from(def: ScalarTypeExtension) -> Self
Source§impl From<SchemaDefinition> for Definition
impl From<SchemaDefinition> for Definition
Source§fn from(def: SchemaDefinition) -> Self
fn from(def: SchemaDefinition) -> Self
Source§impl From<SchemaExtension> for Definition
impl From<SchemaExtension> for Definition
Source§fn from(def: SchemaExtension) -> Self
fn from(def: SchemaExtension) -> Self
Source§impl From<UnionTypeDefinition> for Definition
impl From<UnionTypeDefinition> for Definition
Source§fn from(def: UnionTypeDefinition) -> Self
fn from(def: UnionTypeDefinition) -> Self
Source§impl From<UnionTypeExtension> for Definition
impl From<UnionTypeExtension> for Definition
Source§fn from(def: UnionTypeExtension) -> Self
fn from(def: UnionTypeExtension) -> Self
Source§impl Hash for Definition
impl Hash for Definition
Source§impl PartialEq for Definition
impl PartialEq for Definition
impl Eq for Definition
impl StructuralPartialEq for Definition
Auto Trait Implementations§
impl Freeze for Definition
impl RefUnwindSafe for Definition
impl Send for Definition
impl Sync for Definition
impl Unpin for Definition
impl UnwindSafe for Definition
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.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);