Struct kubos_service::Service
source · [−]pub struct Service {
pub filter: BoxedFilter<(Response<Vec<u8>>,)>,
/* private fields */
}
Expand description
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.
ⓘ
use kubos_service::Service;
let sub = model::Subsystem::new();
Service::new(
"example-service",
sub,
schema::QueryRoot,
schema::MutationRoot,
).start();
Fields
filter: BoxedFilter<(Response<Vec<u8>>,)>
Implementations
sourceimpl Service
impl Service
sourcepub 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,
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
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.
Auto Trait Implementations
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more