Skip to content

Commit 714d3eb

Browse files
committed
docs: adds same snippet of writing to files to lib.rs for crate doc
1 parent 6ebe113 commit 714d3eb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@
4343
//! }
4444
//! ```
4545
//!
46+
//! For writing files:
47+
//!
48+
//! ```rust
49+
//! let my_other_file = root_dir.open_file_in_dir("MY_DATA.CSV", embedded_sdmmc::Mode::ReadWriteCreateOrAppend)?;
50+
//! my_other_file.write(b"Timestamp,Signal,Value\n")?;
51+
//! my_other_file.write(b"2025-01-01T00:00:00Z,TEMP,25.0\n")?;
52+
//! my_other_file.write(b"2025-01-01T00:00:01Z,TEMP,25.1\n")?;
53+
//! my_other_file.write(b"2025-01-01T00:00:02Z,TEMP,25.2\n")?;
54+
//!
55+
//! // Don't forget to flush the file so that the directory entry is updated
56+
//! my_other_file.flush()?;
57+
//! ```
58+
//!
4659
//! ## Features
4760
//!
4861
//! * `log`: Enabled by default. Generates log messages using the `log` crate.

0 commit comments

Comments
 (0)