pub struct ScalarDefinition { /* private fields */ }
Expand description
Represents scalar types such as Int, String, and Boolean. Scalars cannot have fields.
ScalarTypeDefinition: Description? scalar Name Directives?
Detailed documentation can be found in GraphQL spec.
§Example
use apollo_encoder::ScalarDefinition;
let mut scalar = ScalarDefinition::new("NumberOfTreatsPerDay".to_string());
scalar.description(
"Int representing number of treats received.".to_string(),
);
assert_eq!(
scalar.to_string(),
r#""Int representing number of treats received."
scalar NumberOfTreatsPerDay
"#
);
Implementations§
Source§impl ScalarDefinition
impl ScalarDefinition
Sourcepub fn description(&mut self, description: String)
pub fn description(&mut self, description: String)
Set the ScalarDef’s description.
Trait Implementations§
Source§impl Clone for ScalarDefinition
impl Clone for ScalarDefinition
Source§fn clone(&self) -> ScalarDefinition
fn clone(&self) -> ScalarDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ScalarDefinition
impl Debug for ScalarDefinition
Source§impl Display for ScalarDefinition
impl Display for ScalarDefinition
Source§impl PartialEq for ScalarDefinition
impl PartialEq for ScalarDefinition
Source§impl TryFrom<ScalarTypeDefinition> for ScalarDefinition
impl TryFrom<ScalarTypeDefinition> for ScalarDefinition
Source§fn try_from(node: ScalarTypeDefinition) -> Result<Self, Self::Error>
fn try_from(node: ScalarTypeDefinition) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
§Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.
Source§impl TryFrom<ScalarTypeExtension> for ScalarDefinition
impl TryFrom<ScalarTypeExtension> for ScalarDefinition
Source§fn try_from(node: ScalarTypeExtension) -> Result<Self, Self::Error>
fn try_from(node: ScalarTypeExtension) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
§Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.