This commit is contained in:
Alex 2022-11-17 16:56:55 +01:00
parent 4d4f9336d6
commit dc5bcec658
Signed by: lx
GPG key ID: 0E496D15096376BE

View file

@ -251,7 +251,6 @@ impl<'a, 'b> Term<'a, 'b> {
} }
/// Checks term is a dictionnary and returns hashmap of inner terms. /// Checks term is a dictionnary and returns hashmap of inner terms.
/// For convenience, this transforms the keys of the dictionnary into `&str`'s.
/// ///
/// Example: /// Example:
/// ///
@ -289,7 +288,7 @@ impl<'a, 'b> Term<'a, 'b> {
/// assert_eq!(s1.str().unwrap(), "v1"); /// assert_eq!(s1.str().unwrap(), "v1");
/// assert_eq!(s2.str().unwrap(), "v2"); /// assert_eq!(s2.str().unwrap(), "v2");
/// ///
/// assert!(term.dict_of([b"k1", b"k2"], false).is_err()); /// assert!(term.dict_of(["k1", "k2"], false).is_err());
/// ``` /// ```
pub fn dict_of<const N: usize, T: AsRef<[u8]>>( pub fn dict_of<const N: usize, T: AsRef<[u8]>>(
&self, &self,
@ -327,7 +326,7 @@ impl<'a, 'b> Term<'a, 'b> {
/// use nettext::dec::decode; /// use nettext::dec::decode;
/// ///
/// let term = decode(b"{ k1 = v1, k2 = v2, k4 = v4 }").unwrap(); /// let term = decode(b"{ k1 = v1, k2 = v2, k4 = v4 }").unwrap();
/// let [s1, s2, s3] = term.dict_of_opt([b"k1", b"k2", b"k3"], true).unwrap(); /// let [s1, s2, s3] = term.dict_of_opt(["k1", "k2", "k3"], true).unwrap();
/// assert_eq!(s1.unwrap().str().unwrap(), "v1"); /// assert_eq!(s1.unwrap().str().unwrap(), "v1");
/// assert_eq!(s2.unwrap().str().unwrap(), "v2"); /// assert_eq!(s2.unwrap().str().unwrap(), "v2");
/// assert!(s3.is_none()); /// assert!(s3.is_none());