pub struct GraphiQLSource<'a> { /* private fields */ }Available on crate feature
graphiql only.Expand description
A builder for constructing a GraphiQL (v2) HTML page.
§Example
use async_graphql::http::*;
GraphiQLSource::build()
.endpoint("/")
.subscription_endpoint("/ws")
.header("Authorization", "Bearer [token]")
.ws_connection_param("token", "[token]")
.credentials(Credentials::Include)
.finish();Implementations§
Source§impl<'a> GraphiQLSource<'a>
impl<'a> GraphiQLSource<'a>
Sourcepub fn build() -> GraphiQLSource<'a>
pub fn build() -> GraphiQLSource<'a>
Creates a builder for constructing a GraphiQL (v2) HTML page.
Sourcepub fn endpoint(self, endpoint: &'a str) -> GraphiQLSource<'a>
pub fn endpoint(self, endpoint: &'a str) -> GraphiQLSource<'a>
Sets the endpoint of the server GraphiQL will connect to.
Sourcepub fn subscription_endpoint(self, endpoint: &'a str) -> GraphiQLSource<'a>
pub fn subscription_endpoint(self, endpoint: &'a str) -> GraphiQLSource<'a>
Sets the subscription endpoint of the server GraphiQL will connect to.
Sourcepub fn header(self, name: &'a str, value: &'a str) -> GraphiQLSource<'a>
pub fn header(self, name: &'a str, value: &'a str) -> GraphiQLSource<'a>
Sets a header to be sent with requests GraphiQL will send.
Sourcepub fn version(self, value: &'a str) -> GraphiQLSource<'a>
pub fn version(self, value: &'a str) -> GraphiQLSource<'a>
Sets the version of GraphiQL to be fetched.
Sourcepub fn ws_connection_param(
self,
name: &'a str,
value: &'a str,
) -> GraphiQLSource<'a>
pub fn ws_connection_param( self, name: &'a str, value: &'a str, ) -> GraphiQLSource<'a>
Sets a WS connection param to be sent during GraphiQL WS connections.
Sourcepub fn title(self, title: &'a str) -> GraphiQLSource<'a>
pub fn title(self, title: &'a str) -> GraphiQLSource<'a>
Sets the html document title.
Sourcepub fn credentials(self, credentials: Credentials) -> GraphiQLSource<'a>
pub fn credentials(self, credentials: Credentials) -> GraphiQLSource<'a>
Sets credentials option for the fetch requests.
Trait Implementations§
Source§impl<'a> Default for GraphiQLSource<'a>
impl<'a> Default for GraphiQLSource<'a>
Source§fn default() -> GraphiQLSource<'a>
fn default() -> GraphiQLSource<'a>
Returns the “default value” for a type. Read more
Source§impl<'a> Display for GraphiQLSource<'a>
Implement the format!() trait for GraphiQLSource
impl<'a> Display for GraphiQLSource<'a>
Implement the format!() trait for GraphiQLSource
Please be aware of the rendering performance notice in the Template trait.
Source§impl<'a> FastWritable for GraphiQLSource<'a>
impl<'a> FastWritable for GraphiQLSource<'a>
Source§fn write_into<AskamaW>(
&self,
dest: &mut AskamaW,
values: &dyn Values,
) -> Result<()>
fn write_into<AskamaW>( &self, dest: &mut AskamaW, values: &dyn Values, ) -> Result<()>
Used internally by askama to speed up writing some types.
Source§impl<'a> Template for GraphiQLSource<'a>
impl<'a> Template for GraphiQLSource<'a>
Source§const SIZE_HINT: usize = 3315usize
const SIZE_HINT: usize = 3315usize
Provides a rough estimate of the expanded length of the rendered template. Larger
values result in higher memory usage but fewer reallocations. Smaller values result in the
opposite. This value only affects
render. It does not take effect when calling
render_into, write_into, the fmt::Display implementation, or the blanket
ToString::to_string implementation.Source§fn render_into_with_values<AskamaW>(
&self,
__askama_writer: &mut AskamaW,
__askama_values: &dyn Values,
) -> Result<()>
fn render_into_with_values<AskamaW>( &self, __askama_writer: &mut AskamaW, __askama_values: &dyn Values, ) -> Result<()>
Renders the template to the given
writer fmt buffer with provided Values.Source§fn render(&self) -> Result<String, Error>
fn render(&self) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it.Source§fn render_with_values(&self, values: &dyn Values) -> Result<String, Error>
fn render_with_values(&self, values: &dyn Values) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it with provided Values.Source§fn render_into<W>(&self, writer: &mut W) -> Result<(), Error>
fn render_into<W>(&self, writer: &mut W) -> Result<(), Error>
Renders the template to the given
writer fmt buffer.Auto Trait Implementations§
impl<'a> Freeze for GraphiQLSource<'a>
impl<'a> RefUnwindSafe for GraphiQLSource<'a>
impl<'a> Send for GraphiQLSource<'a>
impl<'a> Sync for GraphiQLSource<'a>
impl<'a> Unpin for GraphiQLSource<'a>
impl<'a> UnwindSafe for GraphiQLSource<'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
Mutably borrows from an owned value. Read more
Source§impl<T> DynTemplate for Twhere
T: Template,
impl<T> DynTemplate for Twhere
T: Template,
Source§fn dyn_render(&self) -> Result<String, Error>
fn dyn_render(&self) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it.Source§fn dyn_render_with_values(&self, values: &dyn Values) -> Result<String, Error>
fn dyn_render_with_values(&self, values: &dyn Values) -> Result<String, Error>
Available on crate feature
alloc only.Helper method which allocates a new
String and renders into it with provided Values.Source§fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<(), Error>
fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<(), Error>
Renders the template to the given
writer fmt buffer.Source§fn dyn_render_into_with_values(
&self,
writer: &mut dyn Write,
values: &dyn Values,
) -> Result<(), Error>
fn dyn_render_into_with_values( &self, writer: &mut dyn Write, values: &dyn Values, ) -> Result<(), Error>
Renders the template to the given
writer fmt buffer with provided Values.Source§fn dyn_write_into(&self, writer: &mut dyn Write) -> Result<(), Error>
fn dyn_write_into(&self, writer: &mut dyn Write) -> Result<(), Error>
Available on crate feature
std only.Renders the template to the given
writer io buffer.