pub struct PowerShell { /* private fields */ }
Expand description
Provides a persistent interface for executing PowerShell commands from a .NET runtime hosted inside a Rust application.
Implementations§
Source§impl PowerShell
impl PowerShell
Sourcepub fn new() -> Result<Self, ClrError>
pub fn new() -> Result<Self, ClrError>
Creates a new PowerShell session by initializing the .NET CLR
and loading the System.Management.Automation
assembly.
§Returns
A new PowerShell
instance ready to execute commands.
Sourcepub fn execute(&self, command: &str) -> Result<String, ClrError>
pub fn execute(&self, command: &str) -> Result<String, ClrError>
Executes a PowerShell command and returns its output as a string.
This method creates a new temporary Runspace
and Pipeline
for
each invocation. The result is captured via PSObject.ToString()
.
§Arguments
command
- A PowerShell command to be executed.
§Returns
- Returns the textual output of the PowerShell command.
Auto Trait Implementations§
impl Freeze for PowerShell
impl RefUnwindSafe for PowerShell
impl !Send for PowerShell
impl !Sync for PowerShell
impl Unpin for PowerShell
impl UnwindSafe for PowerShell
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