Skip to main content

Service

Trait Service 

Source
pub trait Service: Send + Sync {
    // Required method
    fn protocol(&self) -> &[u8] ;
}
Expand description

Trait that all ma services must implement.

Each service declares its protocol identifier and provides a handler for incoming connections. Built-in services ship with ma-core; applications add custom services via this trait.

§Examples

use ma_core::Service;

struct MyService;

impl Service for MyService {
    fn protocol(&self) -> &[u8] { b"/ma/my-service/0.0.1" }
}

Required Methods§

Source

fn protocol(&self) -> &[u8]

The protocol identifier for this service.

Implementors§