3232/// `}
3333/// />
3434///
35- /// ```rust,no_run
35+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
36+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
3637/// #![deny(unused_imports)]
3738///
3839/// // !tooltip[/DirStructure/] DirStructure
6869/// `}
6970/// />
7071///
71- /// ```rust,no_run
72+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
73+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
7274/// #![deny(unused_imports)]
7375///
7476/// // !tooltip[/DirStructure/] DirStructure
108110/// `}
109111/// />
110112///
111- /// ```rust,no_run
113+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
114+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
112115/// #![deny(unused_imports)]
113116///
114117/// // !tooltip[/DirStructure/] DirStructure
156159/// />
157160///
158161///
159- #[cfg_attr(all(feature = "json", ), doc = r########## "```rust,no_run
160- #![deny(unused_imports )]
161-
162- // !tooltip[/DirStructure/] DirStructure
163- // !tooltip[/DirStructureItem /] DirStructureItem
164- // !tooltip[/FmtWrapper /] FmtWrapper
165- // !tooltip[/Json /] Json
166- use dir_structure::{DirStructure, traits::sync::DirStructureItem, fmt_wrapper::FmtWrapper, data_formats::json:: Json};
167- use serde ::{Serialize, Deserialize };
168-
169- // !tooltip[/DirStructure/] DirStructure
170- #[derive( DirStructure)]
171- struct Dir {
172- #[dir_structure(path = "input.bin")]
173- binary: Vec<u8>,
174- #[dir_structure(
175- path = "number.txt",
176- // !tooltip[/FmtWrapper/] FmtWrapper
177- with_newtype = FmtWrapper<u64>,
178- )]
179- number: u64,
180- #[dir_structure(
181- path = "f.json",
182- // !mark
183- // !tooltip[/Json/] Json
184- with_newtype = Json<Obj>,
185- )]
186- f: Obj,
187- }
188-
189- // !mark(1:5)
190- #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
191- struct Obj {
192- name: String,
193- age: u32 ,
194- }
195-
196- let path = "dir";
197- // !tooltip[/read/] DirStructureItem::read#
198- let dir = Dir ::read(path)?;
199- // !tooltip[/write/] DirStructureItem::write#
200- dir. write(path)?;
201- Ok::<_, dir_structure::error::Error>(())
202-
203- ```
204- "##########)]
162+ #[cfg_attr(all(feature = "json", feature = "derive", ), doc = r#"```rust,no_run"#)]
163+ #[cfg_attr(not(all(feature = "json", feature = "derive", )), doc = r#"```rust,compile_fail"# )]
164+ /// #![deny(unused_imports)]
165+ ///
166+ /// // !tooltip[/DirStructure /] DirStructure
167+ /// // !tooltip[/DirStructureItem /] DirStructureItem
168+ /// // !tooltip[/FmtWrapper /] FmtWrapper
169+ /// // !tooltip[/Json/] Json
170+ /// use dir_structure ::{DirStructure, traits::sync::DirStructureItem, fmt_wrapper::FmtWrapper, data_formats::json::Json };
171+ /// use serde::{Serialize, Deserialize};
172+ ///
173+ /// // !tooltip[/ DirStructure/] DirStructure
174+ /// #[derive(DirStructure)]
175+ /// struct Dir {
176+ /// #[dir_structure(path = "input.bin")]
177+ /// binary: Vec<u8>,
178+ /// #[dir_structure(
179+ /// path = "number.txt",
180+ /// // !tooltip[/ FmtWrapper/] FmtWrapper
181+ /// with_newtype = FmtWrapper<u64>,
182+ /// )]
183+ /// number: u64,
184+ /// #[dir_structure(
185+ /// path = "f.json",
186+ /// // !mark
187+ /// // !tooltip[/ Json/] Json
188+ /// with_newtype = Json<Obj>,
189+ /// )]
190+ /// f: Obj,
191+ /// }
192+ ///
193+ /// // !mark(1:5)
194+ /// #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
195+ /// struct Obj {
196+ /// name: String ,
197+ /// age: u32,
198+ /// }
199+ ///
200+ /// let path = "dir";
201+ /// // !tooltip[/read/] DirStructureItem ::read#
202+ /// let dir = Dir::read(path)?;
203+ /// // !tooltip[/ write/] DirStructureItem::write#
204+ /// dir.write(path)?;
205+ /// Ok::<_, dir_structure::error::Error>(())
206+ ///
207+ /// ```
205208///
206209/// ## !!steps Let's go back to the basics
207210///
@@ -217,7 +220,8 @@ Ok::<_, dir_structure::error::Error>(())
217220/// />
218221///
219222///
220- /// ```rust,no_run
223+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
224+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
221225/// #![deny(unused_imports)]
222226///
223227/// // !tooltip[/DirStructure/] DirStructure
@@ -256,7 +260,8 @@ Ok::<_, dir_structure::error::Error>(())
256260/// `}
257261/// />
258262///
259- /// ```rust,no_run
263+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
264+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
260265/// #![deny(unused_imports)]
261266///
262267/// // !tooltip[/DirStructure/] DirStructure
@@ -310,7 +315,8 @@ Ok::<_, dir_structure::error::Error>(())
310315/// `}
311316/// />
312317///
313- /// ```rust,no_run
318+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
319+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
314320/// #![deny(unused_imports)]
315321///
316322/// // !tooltip[/DirStructure/] DirStructure
@@ -368,7 +374,10 @@ Ok::<_, dir_structure::error::Error>(())
368374/// `}
369375/// />
370376///
371- /// ```rust,no_run
377+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
378+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
379+ /// #![deny(unused_imports)]
380+ ///
372381/// use std::path::Path;
373382/// // !tooltip[/DirStructure/] DirStructure
374383/// // !tooltip[/DirStructureItem/] DirStructureItem
@@ -437,7 +446,8 @@ Ok::<_, dir_structure::error::Error>(())
437446/// `}
438447/// />
439448///
440- /// ```rust,no_run
449+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
450+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
441451/// #![deny(unused_imports)]
442452///
443453/// // !tooltip[/ext_filter/] ext_filter
@@ -496,7 +506,8 @@ Ok::<_, dir_structure::error::Error>(())
496506/// `}
497507/// />
498508///
499- /// ```rust,no_run
509+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
510+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
500511/// #![deny(unused_imports)]
501512///
502513/// // !tooltip[/ext_filter/] ext_filter
@@ -570,7 +581,8 @@ Ok::<_, dir_structure::error::Error>(())
570581/// `}
571582/// />
572583///
573- /// ```rust,no_run
584+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
585+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
574586/// #![deny(unused_imports)]
575587///
576588/// // !tooltip[/ext_filter/] ext_filter
@@ -652,7 +664,8 @@ Ok::<_, dir_structure::error::Error>(())
652664/// `}
653665/// />
654666///
655- /// ```rust,no_run
667+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
668+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
656669/// #![deny(unused_imports)]
657670///
658671/// // !tooltip[/ext_filter/] ext_filter
@@ -740,7 +753,8 @@ Ok::<_, dir_structure::error::Error>(())
740753/// />
741754///
742755///
743- /// ```rust,no_run
756+ #[cfg_attr(all(feature = "derive", ), doc = r#"```rust,no_run"#)]
757+ #[cfg_attr(not(all(feature = "derive", )), doc = r#"```rust,compile_fail"#)]
744758/// #![deny(unused_imports)]
745759///
746760/// // !tooltip[/ext_filter/] ext_filter
0 commit comments