|
@@ -497,7 +497,7 @@ impl TryInto<HashMap<String, Data>> for Data {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// To cast Data into Shared<Data>
|
|
|
+// To cast Data into `Shared<Data>`
|
|
|
// (Because we're still in the crate, we can do this)
|
|
|
impl From<Data> for Shared<Data> {
|
|
|
fn from(v: Data) -> Self {
|
|
@@ -506,11 +506,11 @@ impl From<Data> for Shared<Data> {
|
|
|
}
|
|
|
|
|
|
impl Data {
|
|
|
- /// Constructs a new empty Vec of Vec<Data>
|
|
|
+ /// Constructs a new empty Vec of `Vec<Data>`
|
|
|
pub fn new_vec() -> Self {
|
|
|
Self::Vec(Vec::new())
|
|
|
}
|
|
|
- /// Constructs a new empty Map of HashMap<String, Data>
|
|
|
+ /// Constructs a new empty Map of `HashMap<String, Data>`
|
|
|
pub fn new_map() -> Self {
|
|
|
Self::Map(HashMap::new())
|
|
|
}
|
|
@@ -560,15 +560,15 @@ impl Data {
|
|
|
}
|
|
|
/// Does Data contain something that holds other Data
|
|
|
///
|
|
|
- /// Vec<Data> or HashMap<String, Data> are examples of "nested" Data
|
|
|
+ /// `Vec<Data>` or `HashMap<String, Data>` are examples of "nested" Data
|
|
|
pub fn is_nested(&self) -> bool {
|
|
|
matches!(self, Self::Vec(_) | Self::Map(_))
|
|
|
}
|
|
|
- /// Is Data the Data::Vec variant (Vec<Data>)
|
|
|
+ /// Is Data the Data::Vec variant (`Vec<Data>`)
|
|
|
pub fn is_vec(&self) -> bool {
|
|
|
matches!(self, Self::Vec(_))
|
|
|
}
|
|
|
- /// Is Data the Data::Map variant (HashMap<String, Data>)
|
|
|
+ /// Is Data the Data::Map variant (`HashMap<String, Data>`)
|
|
|
pub fn is_map(&self) -> bool {
|
|
|
matches!(self, Self::Map(_))
|
|
|
}
|
|
@@ -705,7 +705,7 @@ impl Data {
|
|
|
_ => None,
|
|
|
}
|
|
|
}
|
|
|
- /// Gets by index or range for a Vec, see [Vec::get]
|
|
|
+ /// Gets by index or range for a Vec
|
|
|
pub fn vec_get<I>(&self, index: I) -> Option<&I::Output>
|
|
|
where
|
|
|
I: SliceIndex<[Data]>,
|
|
@@ -725,11 +725,11 @@ impl Data {
|
|
|
_ => None,
|
|
|
}
|
|
|
}
|
|
|
- /// Swaps a with b in a Vec, see [Vec::swap]
|
|
|
+ /// Swaps a with b in a Vec
|
|
|
pub fn vec_swap(&mut self, a: usize, b: usize) {
|
|
|
if let Self::Vec(v) = self { v.swap(a, b) }
|
|
|
}
|
|
|
- /// Reverses the order of a Vec, see [Vec::reverse]
|
|
|
+ /// Reverses the order of a Vec
|
|
|
pub fn vec_reverse(&mut self) {
|
|
|
if let Self::Vec(v) = self { v.reverse() }
|
|
|
}
|