pub struct NativeRuntimeAdapter { /* private fields */ }Expand description
原生运行时适配器
Implementations§
Source§impl NativeRuntimeAdapter
impl NativeRuntimeAdapter
Sourcepub fn with_storage_path(self, path: impl AsRef<Path>) -> Self
pub fn with_storage_path(self, path: impl AsRef<Path>) -> Self
设置自定义存储路径
Sourcepub fn with_capabilities(self, capabilities: RuntimeCapabilities) -> Self
pub fn with_capabilities(self, capabilities: RuntimeCapabilities) -> Self
设置自定义能力
Trait Implementations§
Source§impl Default for NativeRuntimeAdapter
impl Default for NativeRuntimeAdapter
Source§impl RuntimeAdapter for NativeRuntimeAdapter
impl RuntimeAdapter for NativeRuntimeAdapter
Source§fn platform(&self) -> RuntimePlatform
fn platform(&self) -> RuntimePlatform
获取运行时平台类型
Source§fn capabilities(&self) -> RuntimeCapabilities
fn capabilities(&self) -> RuntimeCapabilities
获取运行时能力
Source§fn storage_path(&self) -> PathBuf
fn storage_path(&self) -> PathBuf
获取存储路径 Read more
Source§fn build_shell_command(
&self,
command: &str,
working_dir: Option<&Path>,
) -> Result<Command, RuntimeError>
fn build_shell_command( &self, command: &str, working_dir: Option<&Path>, ) -> Result<Command, RuntimeError>
构建 shell 命令 Read more
Source§fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<String, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<String, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
读取文件 Read more
Source§fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
写入文件 Read more
Source§fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
检查文件是否存在
Source§fn file_size<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<u64, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_size<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<u64, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
获取文件大小
Source§fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
列出目录内容
Source§fn create_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
创建目录
Source§fn execute_shell<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
command: &'life1 str,
working_dir: Option<&'life2 Path>,
timeout_secs: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<ShellResult, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_shell<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
command: &'life1 str,
working_dir: Option<&'life2 Path>,
timeout_secs: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<ShellResult, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
执行 shell 命令 Read more
Source§fn set_env(&self, key: &str, value: &str) -> Result<(), RuntimeError>
fn set_env(&self, key: &str, value: &str) -> Result<(), RuntimeError>
设置环境变量(如果运行时支持) Read more
Source§fn memory_budget(&self) -> u64
fn memory_budget(&self) -> u64
获取内存预算(字节,0 表示无限制)
Source§fn has_shell_access(&self) -> bool
fn has_shell_access(&self) -> bool
检查是否有 shell 访问权限
Source§fn has_filesystem_access(&self) -> bool
fn has_filesystem_access(&self) -> bool
检查是否有文件系统访问权限
Source§fn has_network_access(&self) -> bool
fn has_network_access(&self) -> bool
检查是否支持网络访问
Source§fn supports_long_running(&self) -> bool
fn supports_long_running(&self) -> bool
检查是否支持长时间运行
Source§fn current_timestamp(&self) -> u64
fn current_timestamp(&self) -> u64
获取当前时间戳
Auto Trait Implementations§
impl Freeze for NativeRuntimeAdapter
impl RefUnwindSafe for NativeRuntimeAdapter
impl Send for NativeRuntimeAdapter
impl Sync for NativeRuntimeAdapter
impl Unpin for NativeRuntimeAdapter
impl UnsafeUnpin for NativeRuntimeAdapter
impl UnwindSafe for NativeRuntimeAdapter
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