pub struct PSItemInferrator;Expand description
This rule will stop on the special var $_ And check if it’s used into a foreach command And then will infer the result of the previous command in the pipe into a PItem value
§Example
let mut tree = build_powershell_tree("-join ((0x61, 0x62, 0x63)|% {[char]$_})").unwrap();
tree.apply_mut(&mut (
ParseInt::default(),
Forward::default(),
Cast::default(),
PSItemInferrator::default(),
ForEach::default(),
JoinOperator::default(),
ParseArrayLiteral::default(),
ParseType::default()
)
).unwrap();
let mut ps_litter_view = Linter::new();
tree.apply(&mut ps_litter_view).unwrap();
assert_eq!(ps_litter_view.output, "\"abc\"");Trait Implementations§
Source§impl Default for PSItemInferrator
impl Default for PSItemInferrator
Source§fn default() -> PSItemInferrator
fn default() -> PSItemInferrator
Returns the “default value” for a type. Read more
Source§impl<'a> RuleMut<'a> for PSItemInferrator
impl<'a> RuleMut<'a> for PSItemInferrator
type Language = Powershell
fn enter( &mut self, _node: &mut NodeMut<'a, Self::Language>, _flow: ControlFlow, ) -> MinusOneResult<()>
fn leave( &mut self, node: &mut NodeMut<'a, Self::Language>, _flow: ControlFlow, ) -> MinusOneResult<()>
Auto Trait Implementations§
impl Freeze for PSItemInferrator
impl RefUnwindSafe for PSItemInferrator
impl Send for PSItemInferrator
impl Sync for PSItemInferrator
impl Unpin for PSItemInferrator
impl UnsafeUnpin for PSItemInferrator
impl UnwindSafe for PSItemInferrator
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