#[non_exhaustive]pub struct Origin {
pub kind: OriginKind,
pub name: Option<String>,
pub match_pct: Option<u8>,
}Expand description
How a target came to be, with the match percentage when it came from memory. Build it with Origin::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: OriginKindMemory, machine, AI, person or other.
name: Option<String>Engine, memory or person: “Acme TM”, “engine-2”, “ana”. Free text.
match_pct: Option<u8>Match percentage as the file states it (0 to 100; some tools write 101 for a context match).
Implementations§
Source§impl Origin
impl Origin
Sourcepub fn new(kind: OriginKind) -> Origin
pub fn new(kind: OriginKind) -> Origin
An origin of this kind, with no name and no match percentage.
Sourcepub fn with_match(self, pct: u8) -> Origin
pub fn with_match(self, pct: u8) -> Origin
Sets the match percentage.
Sourcepub fn with_match_pct(self, pct: Option<u8>) -> Origin
pub fn with_match_pct(self, pct: Option<u8>) -> Origin
Sets (or with None clears) the match percentage.
Sourcepub fn with_name(self, name: impl IntoOptionString) -> Origin
pub fn with_name(self, name: impl IntoOptionString) -> Origin
Sets (or with None clears) the engine, memory or person name.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Origin
impl<'de> Deserialize<'de> for Origin
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Origin
impl StructuralPartialEq for Origin
Auto Trait Implementations§
impl Forget for Origin
impl Freeze for Origin
impl Move for Origin
impl RefUnwindSafe for Origin
impl Send for Origin
impl Sync for Origin
impl Unpin for Origin
impl UnsafeUnpin for Origin
impl UnwindSafe for Origin
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
Mutably borrows from an owned value. Read more