pub trait Runtime:
Send
+ Sync
+ Debug {
// Required methods
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<FileMetadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn exists(&self, path: &Path) -> bool;
fn resolve(&self, specifier: &str, from: &Path) -> RuntimeResult<PathBuf>;
fn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
recursive: bool,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_cwd(&self) -> RuntimeResult<PathBuf>;
}Required Methods§
Sourcefn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<u8>>> + 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 = RuntimeResult<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a file from the filesystem
Sourcefn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + 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 [u8],
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write a file to the filesystem
Sourcefn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<FileMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<FileMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file metadata
Sourcefn resolve(&self, specifier: &str, from: &Path) -> RuntimeResult<PathBuf>
fn resolve(&self, specifier: &str, from: &Path) -> RuntimeResult<PathBuf>
Resolve a module specifier
Sourcefn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
recursive: bool,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
recursive: bool,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a directory
Sourcefn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a file
Sourcefn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a directory
Sourcefn get_cwd(&self) -> RuntimeResult<PathBuf>
fn get_cwd(&self) -> RuntimeResult<PathBuf>
Get the current working directory
§Educational Note: Working Directory on Native
On native platforms, this delegates to std::env::current_dir().
This abstraction allows the bundler to work without directly calling
OS-specific functions, making the code platform-agnostic.