Trait Service

Source
pub trait Service<B: Backend> {
    type Migration: Migration + 'static;

    // Required methods
    fn sid() -> u32;
    fn need_top_id() -> bool;
    fn migration() -> Self::Migration;
}
Expand description

A service running on top of a Container.

A concrete service should implement this trait. Later, such a service can be instantiated with Container::open_service resp. Container::create_service.

Required Associated Types§

Source

type Migration: Migration + 'static

The migration assiciated with this service.

Required Methods§

Source

fn sid() -> u32

The service identifier.

This is a number that identifies the service, which must be greater than 0.

The sid is stored in the header of the container. When opening a service the stored sid must match with this sid, otherwise the open attempt is rejected.

Source

fn need_top_id() -> bool

Returns true if the service requires a top-id.

If a top-id is required, a top-id is aquired and stored in the header of the container when creating a service-instance.

Source

fn migration() -> Self::Migration

Returns the migration assiciated with this service.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§