pub struct FormatString;Expand description
This rule will infer format operator
§Example
use minusone::tree::{HashMapStorage, Tree};
use minusone::ps::build_powershell_tree;
use minusone::ps::forward::Forward;
use minusone::ps::linter::Linter;
use minusone::ps::string::{ParseString, FormatString};
use minusone::ps::array::ParseArrayLiteral;
let mut tree = build_powershell_tree("\"{1} {0}\" -f 'world', 'hello'").unwrap();
tree.apply_mut(&mut (
ParseString::default(),
Forward::default(),
FormatString::default(),
ParseArrayLiteral::default())
).unwrap();
let mut ps_litter_view = Linter::new();
tree.apply(&mut ps_litter_view).unwrap();
assert_eq!(ps_litter_view.output, "\"hello world\"");Trait Implementations§
Source§impl Default for FormatString
impl Default for FormatString
Source§fn default() -> FormatString
fn default() -> FormatString
Returns the “default value” for a type. Read more
Source§impl<'a> RuleMut<'a> for FormatString
impl<'a> RuleMut<'a> for FormatString
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 FormatString
impl RefUnwindSafe for FormatString
impl Send for FormatString
impl Sync for FormatString
impl Unpin for FormatString
impl UnsafeUnpin for FormatString
impl UnwindSafe for FormatString
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