diff --git a/src/range_bounds_map.rs b/src/range_bounds_map.rs index f21f386..ff6b3bb 100644 --- a/src/range_bounds_map.rs +++ b/src/range_bounds_map.rs @@ -1384,6 +1384,31 @@ where self.inner.last_key_value() } + /// Allocate a `RangeBoundsMap` and move the given (`RangeBounds`, + /// `Value`) entries from the slice into the map using + /// [`RangeBoundsMap::insert_strict()`]. + /// + /// May return an `Err` while inserting. See + /// [`RangeBoundsMap::insert_strict()`] for details. + /// + /// # Panics + /// + /// Panics if any of the given `RangeBounds` is an invalid + /// `RangeBounds`. See [`Invalid + /// RangeBounds`](https://docs.rs/range_bounds_map/latest/range_bounds_map/index.html#Invalid-RangeBounds) + /// for more details. + /// + /// # Examples + /// ``` + /// use range_bounds_map::{RangeBoundsMap, TryFromBoundsError}; + /// + /// let map = RangeBoundsMap::from_slice_strict([ + /// (1..4, false), + /// (4..8, true), + /// (8..100, false), + /// ]) + /// .unwrap(); + /// ``` pub fn from_slice_strict( slice: [(K, V); N], ) -> Result, OverlapError> { diff --git a/src/range_bounds_set.rs b/src/range_bounds_set.rs index 7fa8229..60bfaf8 100644 --- a/src/range_bounds_set.rs +++ b/src/range_bounds_set.rs @@ -224,7 +224,7 @@ where impl Serialize for RangeBoundsSet where - I: Ord + Copy, + I: Ord + Copy, K: NiceRange + Serialize, { fn serialize(&self, serializer: S) -> Result @@ -241,7 +241,7 @@ where impl<'de, I, K> Deserialize<'de> for RangeBoundsSet where - I: Ord + Copy, + I: Ord + Copy, K: NiceRange + Deserialize<'de>, { fn deserialize(deserializer: D) -> Result