Expand description
In addition to handling explicit escape sequences to enable hyperlinks, we also support defining rules that match text from screen lines and generate implicit hyperlinks. This can be used both for making http URLs clickable and also to make other text clickable. For example, you might define a rule that makes bug or issue numbers expand to the corresponding URL to view the details for that issue. The Rule struct is configuration that is passed to the terminal and is evaluated when processing mouse hover events.
Fields
regex: Regex
The compiled regex for the rule. This is used to match against a line of text from the screen (typically the line over which the mouse is hovering).
format: String
The format string that defines how to transform the matched
text into a URL. For example, a format string of $0
expands
to the entire matched text, whereas mailto:$0
expands to
the matched text with a mailto:
prefix. More formally,
each instance of $N
(where N is a number) in the format
string is replaced by the capture number N from the regex.
The replacements are carried out in reverse order, starting
with the highest numbered capture first. This avoids issues
with ambiguous replacement of $11
vs $1
in the case of
more complex regexes.
Implementations
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Rule
impl<'de> Deserialize<'de> for Rule
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromDynamic for Rule
impl FromDynamic for Rule
fn from_dynamic(
value: &Value,
options: FromDynamicOptions
) -> Result<Self, Error>
sourceimpl PlaceDynamic for Rule
impl PlaceDynamic for Rule
sourcefn place_dynamic(&self, place: &mut Object)
fn place_dynamic(&self, place: &mut Object)
Convert from Self to Value, by storing directly into the target Object. Read more
Auto Trait Implementations
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more