@@ -99,7 +99,9 @@ macro_rules! println {
9999/// a `SendError`. Those should be handled here.
100100///
101101/// Example:
102- /// ```
102+ /// ```no_run
103+ /// use kinode_process_lib::await_message;
104+ ///
103105/// loop {
104106/// match await_message() {
105107/// Ok(msg) => {
@@ -142,7 +144,22 @@ pub fn spawn(
142144/// function that turns that type into bytes.
143145///
144146/// Example usage:
145- /// ```
147+ /// ```no_run
148+ /// use kinode_process_lib::make_blob;
149+ /// use bincode;
150+ /// use serde::{Serialize, Deserialize};
151+ ///
152+ /// #[derive(Serialize, Deserialize)]
153+ /// struct MyType {
154+ /// field: std::collections::HashMap<String, String>,
155+ /// field_two: std::collections::HashSet<String>,
156+ /// }
157+ ///
158+ /// let my_type = MyType {
159+ /// field: std::collections::HashMap::new(),
160+ /// field_two: std::collections::HashSet::new(),
161+ /// };
162+ ///
146163/// make_blob(&my_type, |t| Ok(bincode::serialize(t)?));
147164/// ```
148165pub fn make_blob < T , F > ( blob : & T , serializer : F ) -> anyhow:: Result < LazyLoadBlob >
@@ -160,7 +177,18 @@ where
160177/// it from bytes with the provided function.
161178///
162179/// Example:
163- /// ```
180+ /// ```no_run
181+ /// use std::collections::{HashMap, HashSet};
182+ /// use kinode_process_lib::get_typed_blob;
183+ /// use bincode;
184+ /// use serde::{Serialize, Deserialize};
185+ ///
186+ /// #[derive(Serialize, Deserialize)]
187+ /// struct MyType {
188+ /// field: HashMap<String, String>,
189+ /// field_two: HashSet<String>,
190+ /// }
191+ ///
164192/// get_typed_blob(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(MyType {
165193/// field: HashMap::new(),
166194/// field_two: HashSet::new(),
@@ -184,7 +212,18 @@ where
184212/// If it does, attempt to deserialize it from bytes with the provided function.
185213///
186214/// Example:
187- /// ```
215+ /// ```no_run
216+ /// use std::collections::{HashMap, HashSet};
217+ /// use kinode_process_lib::get_typed_state;
218+ /// use bincode;
219+ /// use serde::{Serialize, Deserialize};
220+ ///
221+ /// #[derive(Serialize, Deserialize)]
222+ /// struct MyStateType {
223+ /// field: HashMap<String, String>,
224+ /// field_two: HashSet<String>,
225+ /// }
226+ ///
188227/// get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(MyStateType {
189228/// field: HashMap::new(),
190229/// field_two: HashSet::new(),
0 commit comments