Skip to main content

NativeRuntimeAdapter

Struct NativeRuntimeAdapter 

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

原生运行时适配器

Implementations§

Source§

impl NativeRuntimeAdapter

Source

pub fn new() -> Self

创建新的原生运行时适配器

Source

pub fn with_storage_path(self, path: impl AsRef<Path>) -> Self

设置自定义存储路径

Source

pub fn with_capabilities(self, capabilities: RuntimeCapabilities) -> Self

设置自定义能力

Trait Implementations§

Source§

impl Default for NativeRuntimeAdapter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl RuntimeAdapter for NativeRuntimeAdapter

Source§

fn name(&self) -> &str

获取运行时名称
Source§

fn platform(&self) -> RuntimePlatform

获取运行时平台类型
Source§

fn capabilities(&self) -> RuntimeCapabilities

获取运行时能力
Source§

fn storage_path(&self) -> PathBuf

获取存储路径 Read more
Source§

fn temp_path(&self) -> PathBuf

获取临时目录路径
Source§

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,

读取文件 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,

写入文件 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,

检查文件是否存在
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,

获取文件大小
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,

列出目录内容
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,

创建目录
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,

执行 shell 命令 Read more
Source§

fn get_env(&self, key: &str) -> Option<String>

获取环境变量
Source§

fn set_env(&self, key: &str, value: &str) -> Result<(), RuntimeError>

设置环境变量(如果运行时支持) Read more
Source§

fn log(&self, level: LogLevel, message: &str)

记录日志
Source§

fn memory_budget(&self) -> u64

获取内存预算(字节,0 表示无限制)
Source§

fn has_shell_access(&self) -> bool

检查是否有 shell 访问权限
Source§

fn has_filesystem_access(&self) -> bool

检查是否有文件系统访问权限
Source§

fn has_network_access(&self) -> bool

检查是否支持网络访问
Source§

fn supports_long_running(&self) -> bool

检查是否支持长时间运行
Source§

fn current_timestamp(&self) -> u64

获取当前时间戳

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more