Skip to content

Commit 3799beb

Browse files
1 parent 03bcdbc commit 3799beb

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

README.md

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -197,45 +197,40 @@ follows:
197197
1. **Implement a Trait:** In `Mountain/Source/Environment/`, provide the
198198
concrete implementation for a `Common` trait.
199199

200-
```rust
201-
202-
// In Mountain/Source/Environment/FileSystemProvider.rs
203-
204-
use Common::FileSystem::{FileSystemReader, FileSystemWriter};
205-
206-
#[async_trait]
207-
impl FileSystemReader for MountainEnvironment {
208-
async fn ReadFile(&self, Path: &PathBuf) -> Result<Vec<u8>, CommonError> {
209-
210-
// ... actual `tokio::fs` call ...
200+
```rust
201+
// In Mountain/Source/Environment/FileSystemProvider.rs
211202

212-
}
203+
use Common::FileSystem::{FileSystemReader, FileSystemWriter};
213204

214-
// ...
205+
#[async_trait]
206+
impl FileSystemReader for MountainEnvironment {
207+
async fn ReadFile(&self, Path: &PathBuf) -> Result<Vec<u8>, CommonError> {
208+
// ... actual `tokio::fs` call ...
209+
}
215210

216-
}
217-
```
211+
// ...
212+
}
213+
```
218214

219215
2. **Create and Execute an Effect:** In business logic, create and run an
220216
effect.
221217

222-
```rust
223-
224-
// In a Mountain service or command
218+
```rust
219+
// In a Mountain service or command
225220

226-
use Common::FileSystem;
227-
use Common::Effect::ApplicationRunTime;
221+
use Common::FileSystem;
222+
use Common::Effect::ApplicationRunTime;
228223

229-
async fn some_logic(runtime: Arc<impl ApplicationRunTime>) {
230-
let path = PathBuf::from("/my/file.txt");
231-
let read_effect = FileSystem::ReadFile(path);
224+
async fn some_logic(runtime: Arc<impl ApplicationRunTime>) {
225+
let path = PathBuf::from("/my/file.txt");
226+
let read_effect = FileSystem::ReadFile(path);
232227

233-
match runtime.Run(read_effect).await {
234-
Ok(content) => info!("File content length: {}", content.len()),
235-
Err(e) => error!("Failed to read file: {:?}", e),
236-
}
237-
}
238-
```
228+
match runtime.Run(read_effect).await {
229+
Ok(content) => info!("File content length: {}", content.len()),
230+
Err(e) => error!("Failed to read file: {:?}", e),
231+
}
232+
}
233+
```
239234

240235
---
241236

0 commit comments

Comments
 (0)