pub struct TimeEntryExtensions(/* private fields */);Expand description
Unknown metadata carried by one TimeEntry, preserved verbatim.
The rule this exists for (C-007, T005): a key a newer tix adds must survive
an edit-and-save round trip instead of being dropped. Values are held as
parsed YAML values rather than strings so a sequence, a mapping or a number
written by another build is preserved as what it is, not rejected for not
being a string. A BTreeMap keeps the render order deterministic, so a file
that did not change does not gain a diff.
Equality is by canonical render rather than by the derived comparison,
because serde_yaml::Value is not Eq (floats are not), while an entry — and
therefore the Issue that holds a list of them — must
stay Eq. Two extension maps are equal exactly when they render identically,
which is also what round-trip stability means here.
Implementations§
Source§impl TimeEntryExtensions
impl TimeEntryExtensions
Sourcepub fn keys(&self) -> impl Iterator<Item = &str>
pub fn keys(&self) -> impl Iterator<Item = &str>
The preserved keys, in canonical (sorted) order.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>
Iterate the preserved (key, value) pairs in canonical order.
Sourcepub fn as_map(&self) -> &BTreeMap<String, Value>
pub fn as_map(&self) -> &BTreeMap<String, Value>
The underlying map, for a caller that must serialize or splice it whole.
Sourcepub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
pub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
Preserve one (key, value) pair, returning the previous value if any.
Sourcepub fn canonical_yaml(&self) -> String
pub fn canonical_yaml(&self) -> String
The canonical YAML render, used for equality and for the tie-break of
TimeEntry’s ordering.
Trait Implementations§
Source§impl Clone for TimeEntryExtensions
impl Clone for TimeEntryExtensions
Source§impl Debug for TimeEntryExtensions
impl Debug for TimeEntryExtensions
Source§impl Default for TimeEntryExtensions
impl Default for TimeEntryExtensions
Source§impl<'de> Deserialize<'de> for TimeEntryExtensions
impl<'de> Deserialize<'de> for TimeEntryExtensions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TimeEntryExtensions
Source§impl PartialEq for TimeEntryExtensions
impl PartialEq for TimeEntryExtensions
Auto Trait Implementations§
impl Freeze for TimeEntryExtensions
impl RefUnwindSafe for TimeEntryExtensions
impl Send for TimeEntryExtensions
impl Sync for TimeEntryExtensions
impl Unpin for TimeEntryExtensions
impl UnsafeUnpin for TimeEntryExtensions
impl UnwindSafe for TimeEntryExtensions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more