pub trait ProcessName {
    // Required method
    fn process_name(&self) -> &str;
}
Expand description

ProcessName is used to uniquely name a process from a Rust type.

It is implemented for common string types such as &str and String, but can be implemented on a custom type to create a process name type.

It is best used with the ProcessName derive macro to generate a unique name.

Example

#[derive(ProcessName)]
struct LoggingProcess;

let process = lunatic::spawn!(|| { /* ... */});
process.register(&LoggingProcess);

Alternatively, you can implement the trait manually.

struct LoggingProcess;

impl ProcessName for LoggingProcess {
    fn process_name(&self) -> &str {
        "global_logging_process"
    }
}

For more information, see the derive macro docs.

Required Methods§

source

fn process_name(&self) -> &str

Implementations on Foreign Types§

source§

impl ProcessName for &str

source§

impl ProcessName for str

source§

impl ProcessName for String

source§

impl<'a> ProcessName for Cow<'a, str>

Implementors§