pub trait ContextualUserFragment {
// Required methods
fn role(&self) -> &'static str;
fn markers(&self) -> (&'static str, &'static str);
fn body(&self) -> String;
fn type_markers() -> (&'static str, &'static str)
where Self: Sized;
// Provided methods
fn matches_text(text: &str) -> bool
where Self: Sized { ... }
fn render(&self) -> String { ... }
fn into(self) -> ResponseItem
where Self: Sized { ... }
fn into_boxed_response_item(self: Box<Self>) -> ResponseItem { ... }
fn into_response_input_item(self) -> ResponseInputItem
where Self: Sized { ... }
}Expand description
Context payload that is injected as a message fragment.
Implementations own the response role and provide the exact fragment body.
Marked fragments also provide start/end markers used to recognize injected
context later. render() concatenates markers and body without adding
separators, so implementations should include any whitespace they need
between tags in body(). Unmarked fragments should leave both markers empty,
in which case the default helpers render only the body and never match
arbitrary text.
Required Methods§
fn role(&self) -> &'static str
fn markers(&self) -> (&'static str, &'static str)
fn body(&self) -> String
fn type_markers() -> (&'static str, &'static str)where
Self: Sized,
Provided Methods§
fn matches_text(text: &str) -> boolwhere
Self: Sized,
fn render(&self) -> String
fn into(self) -> ResponseItemwhere
Self: Sized,
fn into_boxed_response_item(self: Box<Self>) -> ResponseItem
fn into_response_input_item(self) -> ResponseInputItemwhere
Self: Sized,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".