pub trait Messages: Sync {
// Required method
fn message(&self, fault: &Fault) -> String;
}Available on crate features
json or toml or yaml only.Expand description
The words of every Fault, so a CLI can write them in another language
or another voice.
A fault’s variant and span stay the same whatever words it gets. The trait words a fault and nothing else: the line, the column and the field come from where the fault is.
use ctl_input::format::Fault;
use ctl_input::{EnglishMessages, Messages};
let fault = Fault::MissingField { field: "port" };
assert_eq!(EnglishMessages.message(&fault), "missing field `port`");Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".