pub struct RestrictedRuntimeAdapter { /* private fields */ }Expand description
受限运行时适配器(用于 WASM 等受限环境)
Implementations§
Trait Implementations§
Source§impl Default for RestrictedRuntimeAdapter
impl Default for RestrictedRuntimeAdapter
Source§impl RuntimeAdapter for RestrictedRuntimeAdapter
impl RuntimeAdapter for RestrictedRuntimeAdapter
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 RestrictedRuntimeAdapter
impl RefUnwindSafe for RestrictedRuntimeAdapter
impl Send for RestrictedRuntimeAdapter
impl Sync for RestrictedRuntimeAdapter
impl Unpin for RestrictedRuntimeAdapter
impl UnsafeUnpin for RestrictedRuntimeAdapter
impl UnwindSafe for RestrictedRuntimeAdapter
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