[][src]Struct kubos_service::Service

pub struct Service {
    pub filter: BoxedFilter<(Response<Vec<u8>>,)>,
    // some 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.


Creating and starting a service.

This example is not tested
use kubos_service::Service;

let sub = model::Subsystem::new();


filter: BoxedFilter<(Response<Vec<u8>>,)>


impl Service[src]

pub fn new<Query, Mutation, S>(
    config: Config,
    subsystem: S,
    query: Query,
    mutation: Mutation
) -> Self where
    Query: GraphQLType<Context = Context<S>, TypeInfo = ()> + Send + Sync + 'static,
    Mutation: GraphQLType<Context = Context<S>, TypeInfo = ()> + Send + Sync + 'static,
    S: Send + Sync + Clone + 'static, 

Creates a new service instance


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.

pub fn start(self)[src]

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


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.

Auto Trait Implementations

impl Unpin for Service

impl Sync for Service

impl Send for Service

impl !UnwindSafe for Service

impl !RefUnwindSafe for Service

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T> UnsafeAny for T where
    T: Any

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,