pub struct Part {Show 17 fields
pub id: String,
pub number: String,
pub part_type: String,
pub sequence: u64,
pub document_class: DocumentClass,
pub name: String,
pub description: String,
pub category: String,
pub tags: Vec<String>,
pub external_ref: String,
pub attributes: BTreeMap<String, Value>,
pub sourcing: Vec<ManufacturerPart>,
pub member_part_type: String,
pub attachments: Vec<Attachment>,
pub created_by: String,
pub created_at: Timestamp,
pub revisions: Vec<Revision>,
}Expand description
A part: permanent identity, the number, and its revisions oldest-first.
Fields§
§id: StringThe part number itself, stored directly as the database primary key.
number: StringThe number (CPART000000001, or whatever the type’s mode accepted).
Unique across the server, compared without regard to ASCII case.
part_type: StringWhich PartType minted or accepted the number.
sequence: u64The counter value the number was spelled from, kept so a renumbering or
an audit does not have to re-parse the string. 0 for a number that
did not come from a counter.
document_class: DocumentClassWhat the part’s document is for. Fixed at creation.
name: String§description: String§category: StringThe part’s ONE primary Category, by id. Empty is uncategorized.
A value that names no category — text written before the catalog
existed — loads as-is and reads as uncategorized; it is replaced the
next time someone sets the category.
external_ref: StringThe upstream library identity for an imported part ("Timer:NE555D"),
which is what makes a re-import idempotent. Inert today.
attributes: BTreeMap<String, Value>Catalog attribute values, keyed by AttributeDef::key. Checked
against the category’s schema when written; COMPLETE (every required
key present) only at release, because a draft may be unfinished. A
value whose key the current category does not define is kept — moving
a part between categories never throws data away — and is inert.
sourcing: Vec<ManufacturerPart>Who makes this part and who sells it: the approved manufacturer parts,
each with its supplier offers. Part-level, like attributes, and NOT
frozen by Settings::lock_released_attributes — sourcing changes
with the market, not with the design.
member_part_type: StringFor a family or a template: the part type its generated parts are created in — a family’s new members, a template’s spin-outs. Empty means the family’s or template’s own type. Inert on a normal part.
attachments: Vec<Attachment>Files that belong to the part whatever its revision — a datasheet, a
supplier drawing. Not frozen by a release: like sourcing, they follow
the part, not one design of it. See Attachment.
created_by: String§created_at: Timestamp§revisions: Vec<Revision>Implementations§
Source§impl Part
impl Part
pub fn revision(&self, revision_id: &str) -> Option<&Revision>
pub fn revision_mut(&mut self, revision_id: &str) -> Option<&mut Revision>
Sourcepub fn latest(&self) -> Option<&Revision>
pub fn latest(&self) -> Option<&Revision>
The newest revision, whatever its state. “Newest” is creation order — the list’s order — because a free-text label says nothing about age.
Sourcepub fn revision_by_label(&self, label: &str) -> Option<&Revision>
pub fn revision_by_label(&self, label: &str) -> Option<&Revision>
The revision labelled label, compared without regard to ASCII case —
a and A would be two revisions nobody could tell apart aloud.
Sourcepub fn open_draft(&self) -> Option<&Revision>
pub fn open_draft(&self) -> Option<&Revision>
The first revision still in work (Draft or InReview), if any. Whether a
second may be started beside it is the administrator’s
Settings::allow_multiple_open_drafts.
Sourcepub fn current_release(&self) -> Option<&Revision>
pub fn current_release(&self) -> Option<&Revision>
The revision currently Released. A release supersedes every other, so there is at most one.
Sourcepub fn catalog_frozen(&self) -> bool
pub fn catalog_frozen(&self) -> bool
Whether Settings::lock_released_attributes would freeze this part’s
catalog values: some revision has been released (whatever it is now),
and none is in work to carry a change.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Part
impl<'de> Deserialize<'de> for Part
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>,
Auto Trait Implementations§
impl Forget for Part
impl Freeze for Partwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<String>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<ManufacturerPart>: Freeze,
PhantomData<Attachment>: Freeze,
PhantomData<Revision>: Freeze,
impl Move for Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnsafeUnpin for Partwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<ManufacturerPart>: UnsafeUnpin,
PhantomData<Attachment>: UnsafeUnpin,
PhantomData<Revision>: UnsafeUnpin,
impl UnwindSafe for Partwhere
RawVecInner: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
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>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.