From 90098086f6140855c4bdd0a3bbd92e3f12d89c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 19 Nov 2024 10:54:55 +0100 Subject: [PATCH 1/2] iter: add current_depth and root_depth --- miniconf/src/iter.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/miniconf/src/iter.rs b/miniconf/src/iter.rs index 6530c842..f3509385 100644 --- a/miniconf/src/iter.rs +++ b/miniconf/src/iter.rs @@ -29,6 +29,14 @@ impl Iterator for ExactSize { } } +impl ExactSize { + /// Return a reference to the inner iterator + #[inline] + pub fn inner(&self) -> &T { + &self.iter + } +} + // Even though general TreeKey iterations may well be longer than usize::MAX // we are sure that the aren't in this case since self.count <= usize::MAX impl ExactSizeIterator for ExactSize {} @@ -52,6 +60,7 @@ impl Keys for Consume { Ok(()) } } + impl IntoKeys for Consume { type IntoKeys = Self; @@ -127,6 +136,16 @@ impl NodeIter { count: meta.count, } } + + /// Return the current iteration depth + pub fn current_depth(&self) -> usize { + self.depth + } + + /// Return the root depth + pub fn root_depth(&self) -> usize { + self.root + } } impl Iterator for NodeIter @@ -173,7 +192,7 @@ where } } -// Do not allow manipulation of `depth` other than through iteration. +// Contract: Do not allow manipulation of `depth` other than through iteration. impl core::iter::FusedIterator for NodeIter { From 43fac62ba908317561708c09ae6000b6cd1a2ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 19 Nov 2024 10:57:01 +0100 Subject: [PATCH 2/2] v0.17.2 chores --- CHANGELOG.md | 2 +- miniconf/Cargo.toml | 4 ++-- miniconf_derive/Cargo.toml | 2 +- py/miniconf-mqtt/pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f19ec9a5..1133619f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/quartiq/miniconf/compare/v0.17.1...HEAD) - DATE +## [0.17.2](https://github.com/quartiq/miniconf/compare/v0.17.1...v0.17.2) - 2024-11-19 ### Added diff --git a/miniconf/Cargo.toml b/miniconf/Cargo.toml index 29b8b069..9e1c31a7 100644 --- a/miniconf/Cargo.toml +++ b/miniconf/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miniconf" # Sync all crate versions and the py client -version = "0.17.1" +version = "0.17.2" authors = [ "James Irwin ", "Ryan Summers ", @@ -16,7 +16,7 @@ categories = ["embedded", "config", "data-structures", "parsing"] [dependencies] serde = { version = "1.0.120", default-features = false } -miniconf_derive = { path = "../miniconf_derive", version = "0.17.0", optional = true } +miniconf_derive = { path = "../miniconf_derive", version = "0.17.2", optional = true } itoa = "1.0.4" serde-json-core = { version = "0.6.0", optional = true } postcard = { version = "1.0.8", optional = true } diff --git a/miniconf_derive/Cargo.toml b/miniconf_derive/Cargo.toml index 1d8e05cb..d4ac8ef3 100644 --- a/miniconf_derive/Cargo.toml +++ b/miniconf_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "miniconf_derive" -version = "0.17.0" +version = "0.17.2" authors = ["James Irwin ", "Ryan Summers ", "Robert Jördens "] edition = "2021" license = "MIT" diff --git a/py/miniconf-mqtt/pyproject.toml b/py/miniconf-mqtt/pyproject.toml index bdba4891..5f5ff688 100644 --- a/py/miniconf-mqtt/pyproject.toml +++ b/py/miniconf-mqtt/pyproject.toml @@ -8,7 +8,7 @@ text = "MIT" [project] name = "miniconf-mqtt" # Note: keep this in sync with Cargo.toml -version = "0.17.0" +version = "0.17.2" description = "Utilities for configuring Miniconf-configurable devices" authors = [ { name = "Ryan Summers", email = "ryan.summers@vertigo-designs.com" },