#[non_exhaustive]pub struct ProjectPin {
pub schema_version: u32,
pub palace: String,
pub note: Option<String>,
}Expand description
Serialisable schema for .trusty-tools/trusty-memory.yaml.
Why: the pin is the committed, human-authored answer to “which palace is
this project’s”, so it needs a typed schema rather than ad-hoc string
scraping — a field that silently deserialises to the wrong type would
redirect a project’s memory.
What: schema_version (always PIN_SCHEMA_VERSION), palace (the pinned
slug, stored verbatim and never re-slugified), and an optional human note.
Test: reads_a_valid_pin, plus trusty-memory’s write_and_read_pin_round_trips.
#[non_exhaustive] because a future schema field must not be a breaking
change for the crates.io consumers of this crate. That closes struct-literal
construction outside trusty-common, so build one through Self::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.schema_version: u32Pin-file format version.
palace: StringThe pinned palace slug — verbatim, never re-slugified.
note: Option<String>Optional human note (e.g. “pinned before drive reorg 2026-06”).
Implementations§
Source§impl ProjectPin
impl ProjectPin
Sourcepub fn new(palace: impl Into<String>) -> ProjectPin
pub fn new(palace: impl Into<String>) -> ProjectPin
A pin naming palace, at the current PIN_SCHEMA_VERSION, with no note.
Why: ProjectPin is #[non_exhaustive], so no other crate can write
the struct literal. Stamping the version here also stops a caller pinning
an older one by copying an old literal.
What: the two required fields; chain Self::with_note to add the note.
Test: new_stamps_the_current_schema_version.
Sourcepub fn with_note(self, note: Option<String>) -> ProjectPin
pub fn with_note(self, note: Option<String>) -> ProjectPin
Attach the optional human note.
Test: with_note_round_trips_through_yaml.
Trait Implementations§
Source§impl Clone for ProjectPin
impl Clone for ProjectPin
Source§fn clone(&self) -> ProjectPin
fn clone(&self) -> ProjectPin
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 ProjectPin
impl Debug for ProjectPin
Source§impl<'de> Deserialize<'de> for ProjectPin
impl<'de> Deserialize<'de> for ProjectPin
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProjectPin, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProjectPin, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ProjectPin
Source§impl PartialEq for ProjectPin
impl PartialEq for ProjectPin
Source§impl Serialize for ProjectPin
impl Serialize for ProjectPin
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ProjectPin
Auto Trait Implementations§
impl Freeze for ProjectPin
impl RefUnwindSafe for ProjectPin
impl Send for ProjectPin
impl Sync for ProjectPin
impl Unpin for ProjectPin
impl UnsafeUnpin for ProjectPin
impl UnwindSafe for ProjectPin
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§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