[][src]Struct kubos_service::Service

pub struct Service<'a, Query, Mutation, S> where
    Query: GraphQLType<Context = Context<S>> + Send + Sync + 'static,
    Mutation: GraphQLType<Context = Context<S>> + Send + Sync + 'static, 
{ /* fields omitted */ }

This structure represents a hardware service.

Specifically the functionality provided by this struct exists to provide a GraphQL interface over UDP, a means of exposing a subsystem to GraphQL queries and means for persistence throughout GraphQL queries.

Examples

Creating and starting a service.

This example is not tested
use kubos_service::Service;

let sub = model::Subsystem::new();
Service::new(
    "example-service",
    sub,
    schema::QueryRoot,
    schema::MutationRoot,
).start();

Methods

impl<'a, Query, Mutation, S> Service<'a, Query, Mutation, S> where
    Query: GraphQLType<Context = Context<S>, TypeInfo = ()> + Send + Sync + 'static,
    Mutation: GraphQLType<Context = Context<S>, TypeInfo = ()> + Send + Sync + 'static, 
[src]

Creates a new service instance

Arguments

name - The name of the service. This is used to find the appropriate config information subsystem - An instance of the subsystem struct. This one instance will be used by all queries. query - The root query struct holding all other GraphQL queries. mutation - The root mutation struct holding all other GraphQL mutations.

Starts the service's GraphQL/UDP server. This function runs without return.

Panics

The UDP interface will panic if the ip address and port provided cannot be bound (like if they are already in use), or if for some reason the socket fails to receive a message.

Processes a GraphQL query

Auto Trait Implementations

impl<'a, Query, Mutation, S> Send for Service<'a, Query, Mutation, S> where
    S: Send,
    <Mutation as GraphQLType>::TypeInfo: Send,
    <Query as GraphQLType>::TypeInfo: Send

impl<'a, Query, Mutation, S> !Sync for Service<'a, Query, Mutation, S>

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more