pub struct SubInliner { /* private fields */ }Expand description
Text-based Perl subroutine inliner.
Create one instance per source file and call [inline_call] (or its
variants) to produce the inlined expression text.
Implementations§
Source§impl SubInliner
impl SubInliner
Sourcepub fn new(source: &str) -> SubInliner
pub fn new(source: &str) -> SubInliner
Create a new inliner from Perl source text.
Sourcepub fn inline_call(
&self,
sub_name: &str,
call_expr: &str,
) -> Result<String, InlineError>
pub fn inline_call( &self, sub_name: &str, call_expr: &str, ) -> Result<String, InlineError>
Inline a single call to sub_name.
call_expr is the full call expression string, e.g. "add(3, 4)".
Returns the replacement text (the inlined expression), or an
InlineError if the subroutine cannot be inlined.
Sourcepub fn inline_call_with_warnings(
&self,
sub_name: &str,
call_expr: &str,
) -> Result<(String, Vec<String>), InlineError>
pub fn inline_call_with_warnings( &self, sub_name: &str, call_expr: &str, ) -> Result<(String, Vec<String>), InlineError>
Like [inline_call] but also returns any warnings (e.g. side effects).
Sourcepub fn inline_call_with_outer_vars(
&self,
sub_name: &str,
call_expr: &str,
outer_vars: &[String],
) -> Result<String, InlineError>
pub fn inline_call_with_outer_vars( &self, sub_name: &str, call_expr: &str, outer_vars: &[String], ) -> Result<String, InlineError>
Like [inline_call] but accepts a list of variable names that already
exist in the outer scope, so collisions can be detected and renamed.
Auto Trait Implementations§
impl Freeze for SubInliner
impl RefUnwindSafe for SubInliner
impl Send for SubInliner
impl Sync for SubInliner
impl Unpin for SubInliner
impl UnsafeUnpin for SubInliner
impl UnwindSafe for SubInliner
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