[][src]Trait docql::Runtime

pub trait Runtime {
    type Error: ToString;
#[must_use]    fn date<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn get_args<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn query<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
        graphql: &'life2 GraphqlRequest,
        headers: HashMap<String, String>
    ) -> Pin<Box<dyn Future<Output = Result<Value, Self::Error>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn prepare_output_directory<'life0, 'life1, 'async_trait>(
        &'life0 self,
        output: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn write_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        output: &'life1 str,
        file: &'life2 str,
        contents: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
; }

The trait that all tools that use this library must implement.

A runtime provides all of the "outside world" interaction that the library can use to do its job.

This allows docql to be implemented as a native binary and as a wasm-module.

Associated Types

type Error: ToString

The error type that the runtime returns.

Loading content...

Required methods

#[must_use]fn date<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get the current date as an ISO-8601 date

#[must_use]fn get_args<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get the arguments passed on the command (not including the binary name)

Note that standard argv includes the binary name. This method expects the binary name to be stripped from the front. This makes implementing the WASM binary easier.

#[must_use]fn query<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 self,
    url: &'life1 str,
    graphql: &'life2 GraphqlRequest,
    headers: HashMap<String, String>
) -> Pin<Box<dyn Future<Output = Result<Value, Self::Error>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 

Run the given GraphQL request (the introspection query) against the URL, returning the JSON response.

#[must_use]fn read_file<'life0, 'life1, 'async_trait>(
    &'life0 self,
    path: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Read a file from the filesystem.

Used when rendering documentation based on an already downloaded schema.

#[must_use]fn prepare_output_directory<'life0, 'life1, 'async_trait>(
    &'life0 self,
    output: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Prepare the output directory.

The runtime can use this to create the directory, etc.

#[must_use]fn write_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 self,
    output: &'life1 str,
    file: &'life2 str,
    contents: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 

Write contents to the given file.

Loading content...

Implementors

Loading content...