pub struct InteractContext<'a> {
pub matched: &'a str,
pub before: &'a str,
pub after: &'a str,
pub buffer: &'a str,
pub pattern_index: usize,
}Expand description
Context passed to pattern hook callbacks.
Fields§
§matched: &'a strThe matched text.
before: &'a strText before the match.
after: &'a strText after the match.
buffer: &'a strThe full buffer contents.
pattern_index: usizeThe pattern index that matched.
Implementations§
Source§impl InteractContext<'_>
impl InteractContext<'_>
Sourcepub fn send(&self, data: impl Into<String>) -> InteractAction
pub fn send(&self, data: impl Into<String>) -> InteractAction
Create a send action for convenience.
Sourcepub fn send_line(&self, data: impl Into<String>) -> InteractAction
pub fn send_line(&self, data: impl Into<String>) -> InteractAction
Create a send action with the platform’s default line ending.
This previously hardcoded \n, which ConPTY discards, so the action could
never submit a line on Windows. It uses the platform default rather than the
session’s configured LineEnding because
InteractContext carries only match data and has no access to the config;
threading it through would mean adding a public field.
Auto Trait Implementations§
impl<'a> Freeze for InteractContext<'a>
impl<'a> RefUnwindSafe for InteractContext<'a>
impl<'a> Send for InteractContext<'a>
impl<'a> Sync for InteractContext<'a>
impl<'a> Unpin for InteractContext<'a>
impl<'a> UnsafeUnpin for InteractContext<'a>
impl<'a> UnwindSafe for InteractContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more