VM

Struct VM 

Source
pub struct VM { /* private fields */ }
Expand description

虚拟机对象

§Examples

let vm = VM::new(r#"C:\Program Files (x86)\Appeon\Shared\PowerBuilder\PBVM190.DLL"#).unwrap();
let session = vm.new_session("pbrs", &[r#"pbrs\pbw\pbrs.pbl"#]).unwrap();

Implementations§

Source§

impl VM

Source

pub fn new(file_name: impl AsRef<OsStr>) -> Result<VM>

从指定PBVMdll路径加载虚拟机对象

Examples found in repository?
examples/vm.rs (line 4)
3fn main() {
4    let vm = VM::new(r#"C:\Program Files (x86)\Appeon\Shared\PowerBuilder\PBVM190.DLL"#).unwrap();
5    let session = vm.new_session("pbrs", &[r#"pbrs\pbw\pbrs.pbl"#]).unwrap();
6    let rv: String = session.invoke_function("gf_pbtest", pbargs!["test vm"]).unwrap();
7    println!("rv: {}", rv);
8    let rv: pbint = session.invoke_function(("MessageBox", "ISS"), pbargs!["title", "content"]).unwrap();
9    println!("rv: {}", rv);
10}
Source

pub fn new_session<'a>( &'a self, applicationName: impl AsPBStr, libraryList: &[impl AsPBStr], ) -> Result<OwnedSession<'a>>

新建Session对象

Examples found in repository?
examples/vm.rs (line 5)
3fn main() {
4    let vm = VM::new(r#"C:\Program Files (x86)\Appeon\Shared\PowerBuilder\PBVM190.DLL"#).unwrap();
5    let session = vm.new_session("pbrs", &[r#"pbrs\pbw\pbrs.pbl"#]).unwrap();
6    let rv: String = session.invoke_function("gf_pbtest", pbargs!["test vm"]).unwrap();
7    println!("rv: {}", rv);
8    let rv: pbint = session.invoke_function(("MessageBox", "ISS"), pbargs!["title", "content"]).unwrap();
9    println!("rv: {}", rv);
10}
Source

pub fn run_application<'a>( &'a self, applicationName: impl AsPBStr, libraryList: &[impl AsPBStr], commandLine: impl AsPBStr, ) -> Result<OwnedSession<'a>>

运行PB工程

Auto Trait Implementations§

§

impl Freeze for VM

§

impl RefUnwindSafe for VM

§

impl !Send for VM

§

impl !Sync for VM

§

impl Unpin for VM

§

impl UnwindSafe for VM

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.