pub struct CreatorInfo {
pub client: String,
pub version: String,
pub source: CreatorSource,
pub cwd: Option<String>,
}Expand description
Value type describing the writer of a drawer.
Why: each write path builds one of these and merges the rendered tags
into the caller-supplied tag list before persisting. Keeping the
rendering centralised guarantees every write produces tags in the
same order with the same prefixes, so curl + grep workflows stay
stable.
What: holds an owned client name, an owned version string, the source
enum, and an optional cwd. into_tags() consumes the value and
returns the rendered tag list.
Test: creator_info_renders_all_fields,
creator_info_omits_cwd_when_absent.
Fields§
§client: String§version: String§source: CreatorSource§cwd: Option<String>Implementations§
Source§impl CreatorInfo
impl CreatorInfo
Sourcepub fn new_self(client: impl Into<String>, source: CreatorSource) -> Self
pub fn new_self(client: impl Into<String>, source: CreatorSource) -> Self
Build a CreatorInfo with the supplied client + source, defaulting
the version to this crate’s CARGO_PKG_VERSION and the cwd to
whatever the writing process has at construction time.
Why: most call sites want a one-liner; explicit overrides remain
available by mutating the returned value.
What: client.into() + env!("CARGO_PKG_VERSION").into() +
std::env::current_dir().ok().map(...).
Test: creator_info_self_populates_version_and_cwd.
Render the rendered tag strings in stable order.
Why: stable order keeps tests deterministic and gives operators a
predictable layout when they grep through palaces with jq.
What: [client, version, source, cwd?]. cwd is omitted when
absent rather than rendered as an empty string so downstream
consumers can distinguish “writer didn’t share a cwd” from
“writer’s cwd was literally empty”.
Test: creator_info_renders_all_fields,
creator_info_omits_cwd_when_absent.
Sourcepub fn merge_into(self, dst: &mut Vec<String>)
pub fn merge_into(self, dst: &mut Vec<String>)
Render the tags and append them to an existing tag list.
Why: write-path call sites already hold a Vec<String> of
user-supplied tags; merging in place avoids an allocation and
preserves the caller’s ordering.
What: pushes each rendered tag onto dst. Does not deduplicate —
caller is expected to pass a freshly-built or de-duplicated list.
Test: merge_into_appends_creator_tags.
Trait Implementations§
Source§impl Clone for CreatorInfo
impl Clone for CreatorInfo
Source§fn clone(&self) -> CreatorInfo
fn clone(&self) -> CreatorInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CreatorInfo
impl Debug for CreatorInfo
Source§impl PartialEq for CreatorInfo
impl PartialEq for CreatorInfo
Source§fn eq(&self, other: &CreatorInfo) -> bool
fn eq(&self, other: &CreatorInfo) -> bool
self and other values to be equal, and is used by ==.impl Eq for CreatorInfo
impl StructuralPartialEq for CreatorInfo
Auto Trait Implementations§
impl Freeze for CreatorInfo
impl RefUnwindSafe for CreatorInfo
impl Send for CreatorInfo
impl Sync for CreatorInfo
impl Unpin for CreatorInfo
impl UnsafeUnpin for CreatorInfo
impl UnwindSafe for CreatorInfo
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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